From 2dbe32198b5d59c5d86751381c4d434d4f97eea8 Mon Sep 17 00:00:00 2001 From: Limezy Date: Sat, 17 Feb 2024 11:06:58 +0700 Subject: [PATCH 01/60] Test --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 6cd542f..d8f2902 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "9.0~ynh3" +version = "9.0~ynh4" maintainers = ["Raoul de Limezy"] @@ -34,8 +34,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/cda74b19c2b392886aed48f0ae3a6c6d9b2869a3.zip" - sha256 = "e7b4a6b3350d80106245cd27a529e53ed477764ee59686d8a6f599faec9997e6" + url = "https://github.com/jean-io/moncycle.app/archive/600ff4d8782ea470a8322877123e26ed06598758.zip" + sha256 = "54aa6500e476d00306ac62f7a83df8f45bd1193c0b0758983bf99377ce7fdee6" [resources.system_user] From adf68c66017b34285170816602e3136609f531a2 Mon Sep 17 00:00:00 2001 From: Limezy Date: Mon, 19 Feb 2024 13:45:31 +0700 Subject: [PATCH 02/60] Update nginx --- conf/nginx.conf | 2 +- scripts/install | 1 - scripts/upgrade | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 37886f7..fc1bdbe 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,7 +26,7 @@ location __PATH__/ { } # Default indexes and catch-all - rewrite ^/(connexion|compte)$ /$1.html; + rewrite ^/(connexion|compte)$ /$1.php; rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2; index index.php index.html; try_files $uri $uri/ $uri.php?$args; diff --git a/scripts/install b/scripts/install index 4025c36..45d3600 100755 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,6 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -ynh_exec_warn_less mkdir "$install_dir/sessions" ynh_exec_warn_less mkdir "$install_dir/soap_cache" ynh_exec_warn_less mkdir "$install_dir/composer" diff --git a/scripts/upgrade b/scripts/upgrade index d2e61bc..073a118 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,7 +29,6 @@ popd # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --full_replace=1 -ynh_exec_warn_less mkdir "$install_dir/sessions" ynh_exec_warn_less mkdir "$install_dir/soap_cache" ynh_exec_warn_less mkdir "$install_dir/composer" From 714ea54b6a70eeefba11bee16cfbd54abdc473ed Mon Sep 17 00:00:00 2001 From: Limezy Date: Mon, 19 Feb 2024 13:46:44 +0700 Subject: [PATCH 03/60] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index d8f2902..9a503e1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "9.0~ynh4" +version = "9.0~ynh5" maintainers = ["Raoul de Limezy"] From 2550523abcd573ae80be026c86f40300d9feb3d7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Mon, 19 Feb 2024 13:53:21 +0700 Subject: [PATCH 04/60] Sources --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 9a503e1..031ab27 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,8 +34,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/600ff4d8782ea470a8322877123e26ed06598758.zip" - sha256 = "54aa6500e476d00306ac62f7a83df8f45bd1193c0b0758983bf99377ce7fdee6" + url = "https://github.com/jean-io/moncycle.app/archive/ee19dce2c74ff6e948fae98319cd00eda6ce4117.zip" + sha256 = "ef9a61dbbefa1b5c6454d893ac20b2beba773d7298d40ed47ba9c95636c35b3a" [resources.system_user] From c55f3bdff773a90827ef7fad8cbbaeb470ffe940 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 00:18:01 +0700 Subject: [PATCH 05/60] Patch sources to solve static issue --- .../{app-01-mail.patch => main-01-mail.patch} | 0 sources/patches/main-02-static.patch | 460 ++++++++++++++++++ 2 files changed, 460 insertions(+) rename sources/patches/{app-01-mail.patch => main-01-mail.patch} (100%) create mode 100644 sources/patches/main-02-static.patch diff --git a/sources/patches/app-01-mail.patch b/sources/patches/main-01-mail.patch similarity index 100% rename from sources/patches/app-01-mail.patch rename to sources/patches/main-01-mail.patch diff --git a/sources/patches/main-02-static.patch b/sources/patches/main-02-static.patch new file mode 100644 index 0000000..715ef42 --- /dev/null +++ b/sources/patches/main-02-static.patch @@ -0,0 +1,460 @@ +diff --git a/www_data/lib/db.php b/www_data/lib/db.php +index 73b2d83..61d675d 100644 +--- a/www_data/lib/db.php ++++ b/www_data/lib/db.php +@@ -20,7 +20,7 @@ function db_open() { + function db_select_cycles($db, $no_compte) { + static $sql = "SELECT date_obs AS cycles FROM observation WHERE no_compte = :no_compte AND premier_jour=1 ORDER BY cycles DESC"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -30,7 +30,7 @@ function db_select_cycles($db, $no_compte) { + function db_select_grossesses($db, $no_compte) { + static $sql = "SELECT date_obs AS cycles FROM observation WHERE no_compte = :no_compte AND grossesse=1 ORDER BY cycles DESC"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -40,7 +40,7 @@ function db_select_grossesses($db, $no_compte) { + function db_select_sensations($db, $no_compte) { + static $sql = "select distinct sensation, count(sensation) as nb from observation where sensation is not null and no_compte=:no_compte group by sensation order by nb desc"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -50,7 +50,7 @@ function db_select_sensations($db, $no_compte) { + function db_select_compte_par_nocompte($db, $no_compte) { + static $sql = "select * from compte where no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -60,7 +60,7 @@ function db_select_compte_par_nocompte($db, $no_compte) { + function db_select_compte_par_mail($db, $mail) { + static $sql = "select * from compte where email1 like :email1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":email1", $mail, PDO::PARAM_STR); + $statement->execute(); + +@@ -90,7 +90,7 @@ function db_update_co_echoue($db, $mail){ + function db_select_compte_existe($db, $mail) { + static $sql = "select count(no_compte)>0 as compte_existe from compte where email1 like :email1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":email1", $mail, PDO::PARAM_STR); + $statement->execute(); + +@@ -100,7 +100,7 @@ function db_select_compte_existe($db, $mail) { + function db_insert_compte($db, $nom, $methode, $age, $mail, $mdp, $decouvert, $recherche) { + static $sql = "INSERT INTO compte (nom, methode, age, email1, motdepasse, decouvert, recherche) VALUES (:nom, :methode, :age, :email1, :motdepasse, :decouvert, :recherche)"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":nom", $nom, PDO::PARAM_STR); + $statement->bindValue(":methode", $methode, PDO::PARAM_INT); + $statement->bindValue(":age", $age, PDO::PARAM_INT); +@@ -117,9 +117,9 @@ function db_update_compte_param_str($db, $param, $value, $no_compte) { + $param_list = ["nom", "email1", "email2", "motdepasse", "totp_secret", "derniere_co_date", "inscription_date", "mdp_change_date", "decouvert"]; + if (!in_array($param, $param_list, true)) return false; + +- static $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; ++ $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":cvalue", $value, PDO::PARAM_STR); + $statement->execute(); +@@ -131,9 +131,9 @@ function db_update_compte_param_int($db, $param, $value, $no_compte) { + $param_list = ["methode", "age", "nb_co_echoue", "donateur", "actif", "relance", "timeline_asc", "recherche"]; + if (!in_array($param, $param_list, true)) return false; + +- static $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; ++ $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":cvalue", $value, PDO::PARAM_INT); + $statement->execute(); +@@ -144,7 +144,7 @@ function db_update_compte_param_int($db, $param, $value, $no_compte) { + function db_update_motdepasse_par_mail ($db, $mdp, $mail) { + static $sql = "UPDATE compte SET motdepasse = :motdepasse, mdp_change_date = NULL WHERE email1 = :email1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":email1", $mail, PDO::PARAM_STR); + $statement->bindValue(":motdepasse", $mdp, PDO::PARAM_STR); + $statement->execute(); +@@ -155,7 +155,7 @@ function db_update_motdepasse_par_mail ($db, $mdp, $mail) { + function db_udpate_motdepasse_par_nocompte($db, $mdp, $no_compte) { + static $sql = "UPDATE compte SET motdepasse = :motdepasse, mdp_change_date = now() WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":motdepasse", $mdp, PDO::PARAM_STR); + $statement->execute(); +@@ -166,7 +166,7 @@ function db_udpate_motdepasse_par_nocompte($db, $mdp, $no_compte) { + function db_delete_compte($db, $no_compte){ + static $sql = "DELETE FROM compte WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -176,7 +176,7 @@ function db_delete_compte($db, $no_compte){ + function db_delete_jetton($db, $no_jetton, $no_compte){ + static $sql = "DELETE FROM `jetton` WHERE `no_jetton` = :no_jetton AND `no_compte` = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_jetton", $no_jetton, PDO::PARAM_INT); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); +@@ -187,7 +187,7 @@ function db_delete_jetton($db, $no_jetton, $no_compte){ + function db_delete_observation($db, $no_compte, $date){ + static $sql = "DELETE FROM observation WHERE no_compte = :no_compte AND date_obs = :date"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":date", $date, PDO::PARAM_STR); + $statement->execute(); +@@ -198,7 +198,7 @@ function db_delete_observation($db, $no_compte, $date){ + function db_delete_vieux_jetton($db) { + static $sql = "DELETE FROM jetton WHERE (date_creation < (CURDATE() + INTERVAL - 365 DAY) OR date_use < (CURDATE() + INTERVAL - 40 DAY)) AND expire>0"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->rowCount(); +@@ -207,7 +207,7 @@ function db_delete_vieux_jetton($db) { + function db_select_all_observation($db, $no_compte) { + static $sql = "select * from observation where no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -217,7 +217,7 @@ function db_select_all_observation($db, $no_compte) { + function db_select_observation ($db, $date, $no_compte) { + static $sql = "SELECT * FROM observation WHERE date_obs = :date AND no_compte = :no_compte LIMIT 1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":date", $date, PDO::PARAM_STR); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); +@@ -228,7 +228,7 @@ function db_select_observation ($db, $date, $no_compte) { + function db_insert_observation ($db, $date, $no_compte) { + static $sql = "INSERT INTO observation (no_compte, date_obs, gommette) VALUES (:no_compte, :date, '')"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":date", $date, PDO::PARAM_STR); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); +@@ -239,7 +239,7 @@ function db_insert_observation ($db, $date, $no_compte) { + function db_update_observation ($db, $date, $no_compte, $gommette='', $note_fc=null, $fleche_fc=null, $sensation=null, $temp=null, $htemp=null, $jour_sommet=null, $union_sex=null, $premier_jour=null, $jenesaispas=null, $grossesse=null, $commentaire=null, $compteur=null) { + static $sql = "UPDATE observation SET gommette = :gommette, note_fc = :note_fc, fleche_fc = :fleche_fc, temperature = :temp, heure_temp = :htemp, sensation = :sensation, jour_sommet = :jour_sommet, union_sex = :union_sex, premier_jour = :premier_jour, jenesaispas = :jenesaispas, grossesse = :grossesse, commentaire = :commentaire, compteur = :compteur WHERE date_obs = :date AND no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":gommette", $gommette, PDO::PARAM_STR); + $statement->bindValue(":note_fc", $note_fc, PDO::PARAM_STR); + $statement->bindValue(":fleche_fc", $fleche_fc, PDO::PARAM_STR); +@@ -263,7 +263,7 @@ function db_update_observation ($db, $date, $no_compte, $gommette='', $note_fc=n + function db_select_cycle($db, $date, $no_compte) { + static $sql = "SELECT date_obs AS cycle FROM observation WHERE premier_jour=1 AND date_obs<=:date AND no_compte = :no_compte ORDER BY date_obs DESC LIMIT 1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":date", $date, PDO::PARAM_STR); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); +@@ -274,7 +274,7 @@ function db_select_cycle($db, $date, $no_compte) { + function db_select_cycle_end($db, $date, $no_compte) { + static $sql = "SELECT date_obs AS cycle_end FROM observation WHERE premier_jour=1 and date_obs>:date AND no_compte = :no_compte ORDER BY date_obs ASC LIMIT 1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":date", $date, PDO::PARAM_STR); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); +@@ -285,7 +285,7 @@ function db_select_cycle_end($db, $date, $no_compte) { + function db_select_cycle_grossesse($db, $date, $no_compte) { + static $sql = "SELECT date_obs AS grossesse FROM observation WHERE grossesse=1 and date_obs>:date AND no_compte = :no_compte ORDER BY date_obs ASC LIMIT 1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":date", $date, PDO::PARAM_STR); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); +@@ -296,7 +296,7 @@ function db_select_cycle_grossesse($db, $date, $no_compte) { + function db_select_cycle_complet($db, $date_start, $date_end, $no_compte) { + static $sql = "SELECT date_obs, COALESCE(jenesaispas,'') as '?', COALESCE(note_fc,'') as note_fc, COALESCE(fleche_fc,'') as fleche_fc, gommette, COALESCE(temperature,'') as temperature, COALESCE(heure_temp,'') as heure_temp, COALESCE(sensation,'') as sensation, COALESCE(jour_sommet, '') as sommet, COALESCE(compteur, '') as compteur, COALESCE(union_sex, '') as 'unions', COALESCE(grossesse, '') as 'grossesse', commentaire, COALESCE(premier_jour, 0) as 'premier_jour' FROM observation WHERE date_obs>=:date_start AND date_obs<=:date_end AND no_compte = :no_compte ORDER BY date_obs ASC"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":date_start", $date_start, PDO::PARAM_STR); + $statement->bindValue(":date_end", $date_end, PDO::PARAM_STR); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); +@@ -308,7 +308,7 @@ function db_select_cycle_complet($db, $date_start, $date_end, $no_compte) { + function db_select_nb_compte($db) { + static $sql = "select count(no_compte) as MONCYCLE_APP_NB_COMPTE from compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -317,7 +317,7 @@ function db_select_nb_compte($db) { + function db_select_nb_compte_actif($db) { + static $sql = "select count(distinct no_compte) as MONCYCLE_APP_NB_COMPTE_ACTIF from observation where date_obs >= DATE(NOW()) - INTERVAL 35 DAY"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -326,7 +326,7 @@ function db_select_nb_compte_actif($db) { + function db_select_nb_compte_actif_par_methode($db, $methode) { + static $sql = "select count(distinct obs.no_compte) as MONCYCLE_APP_NB_COMPTE_ACTIF_METHODE from observation as obs left join compte as com on obs.no_compte = com.no_compte where date_obs >= DATE(NOW()) - INTERVAL 35 DAY and com.methode = :methode"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":methode", $methode, PDO::PARAM_INT); + $statement->execute(); + +@@ -336,7 +336,7 @@ function db_select_nb_compte_actif_par_methode($db, $methode) { + function db_select_nb_compte_recent($db) { + static $sql = "select count(no_compte) as MONCYCLE_APP_NB_COMPTE_RECENT from compte where inscription_date >= DATE(NOW()) - INTERVAL 15 DAY and derniere_co_date is not null"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -345,7 +345,7 @@ function db_select_nb_compte_recent($db) { + function db_select_nb_cycle($db) { + static $sql = "select count(no_observation) as MONCYCLE_APP_NB_CYCLE from observation where premier_jour=1 and no_compte!=2"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -354,7 +354,7 @@ function db_select_nb_cycle($db) { + function db_select_nb_cycle_recent($db) { + static $sql = "select count(no_observation) as MONCYCLE_APP_NB_CYCLE_RECENT from observation where premier_jour=1 and date_obs>= DATE(NOW()) - INTERVAL 30 DAY and no_compte!=2"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + return $statement->fetchAll(PDO::FETCH_NUM); + } +@@ -362,7 +362,7 @@ function db_select_nb_cycle_recent($db) { + function db_select_age_moyen($db) { + static $sql = "select year(now())-avg(age)+2.5 as MONCYCLE_APP_NB_AGE_MOYEN from compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -371,7 +371,7 @@ function db_select_age_moyen($db) { + function db_select_age_moyen_recent($db) { + static $sql = "select year(now())-avg(age)+2.5 as MONCYCLE_APP_NB_AGE_MOYEN_RECENT from compte where inscription_date >= DATE(NOW()) - INTERVAL 15 DAY and derniere_co_date is not null and no_compte!=2"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -380,7 +380,7 @@ function db_select_age_moyen_recent($db) { + function db_select_total_observation_count($db) { + static $sql = "select count(no_observation) as MONCYCLE_APP_NB_OBSERVATION from observation where no_compte!=2;"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -389,7 +389,7 @@ function db_select_total_observation_count($db) { + function db_select_observation_aujourdhui($db) { + static $sql = "select count(no_observation) as MONCYCLE_APP_NB_OBSERVATION_AUJOURDHUI from observation where date_obs like DATE(NOW()) and no_compte!=2"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -398,7 +398,7 @@ function db_select_observation_aujourdhui($db) { + function db_select_observation_count($db, $nbj) { + static $sql = "select count(no_observation) as MONCYCLE_APP_NB_OBSERVATION from observation where date_obs>= DATE(NOW()) - INTERVAL :nbj DAY and no_compte!=2"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":nbj", $nbj, PDO::PARAM_INT); + $statement->execute(); + +@@ -408,7 +408,7 @@ function db_select_observation_count($db, $nbj) { + function db_select_jetton_compte($db) { + static $sql = "select count(no_jetton) as MONCYCLE_APP_NB_JETTON from jetton"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); +@@ -417,7 +417,7 @@ function db_select_jetton_compte($db) { + function db_select_cycles_recent($db) { + static $sql = "select subdate(obs.date_obs, 1) as cycle_complet, obs.no_compte as no_compte, c.nom as nom, c.methode as methode, c.email1 as email1, c.email2 as email2 from observation as obs, compte as c where obs.no_compte=c.no_compte and date_obs= DATE(NOW()) - INTERVAL 2 DAY and (premier_jour=1 or grossesse=1)"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_ASSOC); +@@ -426,7 +426,7 @@ function db_select_cycles_recent($db) { + function db_select_compte_inactif($db) { + static $sql = "select `c`.`no_compte` as `no_compte`,`c`.`nom` as `nom`,max(`o`.`dernier_modif`) as `derniere_obs_modif`,`c`.`email1` as `email1`,`c`.`email2` as `email2`,`c`.`inscription_date` as `inscription_date` from `compte` as `c` left join `observation` as `o` on `c`.`no_compte` = `o`.`no_compte` where `c`.`no_compte` != 2 and `c`.`relance`=0 group by `c`.`no_compte` having (date(`derniere_obs_modif`) < date(now()) - interval 35 DAY or `derniere_obs_modif` is null) and `inscription_date` < date(now()) - interval 35 DAY order by `derniere_obs_modif` desc limit 20"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_ASSOC); +@@ -435,7 +435,7 @@ function db_select_compte_inactif($db) { + function db_update_relance ($db, $no_compte, $relance) { + static $sql = "UPDATE compte SET relance = :relance WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":relance", $relance, PDO::PARAM_INT); + $statement->execute(); +@@ -446,7 +446,7 @@ function db_update_relance ($db, $no_compte, $relance) { + function db_insert_jetton($db, $no_compte, $nom, $pays, $jetton_str, $expire=2) { + static $sql = "INSERT INTO `jetton` (`no_compte`, `nom`, `pays`, `jetton_str`, `expire`) VALUES (:no_compte, :nom, :pays, :jetton_str, :expire)"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":expire", $expire, PDO::PARAM_INT); + $statement->bindValue(":nom", $nom, PDO::PARAM_STR); +@@ -460,7 +460,7 @@ function db_insert_jetton($db, $no_compte, $nom, $pays, $jetton_str, $expire=2) + function db_select_compte_jetton($db, $jetton_str) { + static $sql = "SELECT J.no_compte, J.no_jetton, C.nom AS nom_compte, J.pays, J.nom AS nom_jetton, J.date_creation AS d_creation_jetton, J.date_use AS d_use_jetton, C.methode, C.age, C.email1, C.email2, C.nb_co_echoue, C.donateur, C.actif, C.relance, C.derniere_co_date, C.inscription_date, C.mdp_change_date, C.decouvert, C.totp_secret, C.totp_etat, C.recherche, C.timeline_asc FROM `jetton` AS J INNER JOIN `compte` AS C ON J.no_compte=C.no_compte WHERE `jetton_str` = :jetton_str LIMIT 1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":jetton_str", $jetton_str, PDO::PARAM_STR); + $statement->execute(); + +@@ -470,7 +470,7 @@ function db_select_compte_jetton($db, $jetton_str) { + function db_select_jetton_captcha($db, $jetton_str) { + static $sql = "SELECT captcha, no_jetton FROM `jetton` WHERE `jetton_str` = :jetton_str LIMIT 1"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":jetton_str", $jetton_str, PDO::PARAM_STR); + $statement->execute(); + +@@ -480,7 +480,7 @@ function db_select_jetton_captcha($db, $jetton_str) { + function db_update_jetton_use($db, $no_jetton){ + static $sql = "UPDATE `jetton` SET `date_use` = now() WHERE `no_jetton` = :no_jetton"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_jetton", $no_jetton, PDO::PARAM_INT); + $statement->execute(); + +@@ -490,7 +490,7 @@ function db_update_jetton_use($db, $no_jetton){ + function db_update_jetton_captcha($db, $jetton_str, $captcha){ + static $sql = "UPDATE `jetton` SET `date_use` = now(), `captcha` = :captcha WHERE `jetton_str` = :jetton_str"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":jetton_str", $jetton_str, PDO::PARAM_STR); + $statement->bindValue(":captcha", $captcha, PDO::PARAM_STR); + $statement->execute(); +@@ -501,7 +501,7 @@ function db_update_jetton_captcha($db, $jetton_str, $captcha){ + function db_select_tous_les_jetton($db, $no_compte) { + static $sql = "SELECT * FROM jetton where no_compte= :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->execute(); + +@@ -511,7 +511,7 @@ function db_select_tous_les_jetton($db, $no_compte) { + function db_update_increment_cle_valeur($db, $cle){ + static $sql = "update cle_valeur set valeur = valeur+1 where cle like :cle"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":cle", $cle, PDO::PARAM_STR); + $statement->execute(); + +@@ -521,7 +521,7 @@ function db_update_increment_cle_valeur($db, $cle){ + function db_select_cle_valeur($db, $cle) { + static $sql = "select valeur from cle_valeur where cle=:cle"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":cle", $cle, PDO::PARAM_STR); + $statement->execute(); + +@@ -531,7 +531,7 @@ function db_select_cle_valeur($db, $cle) { + function db_update_reset_cle_valeur($db, $cle){ + static $sql = "update cle_valeur set valeur = 0 where cle like :cle"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":cle", $cle, PDO::PARAM_STR); + $statement->execute(); + +@@ -541,7 +541,7 @@ function db_update_reset_cle_valeur($db, $cle){ + function db_update_compte_totp_secret($db, $totp_secret, $no_compte) { + static $sql = "UPDATE compte SET totp_secret = :cvalue WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":cvalue", $totp_secret, PDO::PARAM_STR); + $statement->execute(); +@@ -552,7 +552,7 @@ function db_update_compte_totp_secret($db, $totp_secret, $no_compte) { + function db_update_compte_totp_etat($db, $totp_etat, $no_compte) { + static $sql = "UPDATE compte SET totp_etat = :cvalue WHERE no_compte = :no_compte"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); + $statement->bindValue(":cvalue", $totp_etat, PDO::PARAM_INT); + $statement->execute(); +@@ -563,7 +563,7 @@ function db_update_compte_totp_etat($db, $totp_etat, $no_compte) { + function db_select_compte_avec_totp($db) { + static $sql = "select count(no_compte) as MONCYCLE_APP_NB_COMPTE_AVEC_TOTP from compte where totp_etat=3 and no_compte!=2"; + +- static $statement = $db->prepare($sql); ++ $statement = $db->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(PDO::FETCH_NUM); From c2826934fe222003dacdc0ceae92e9b54af4abcb Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 00:21:09 +0700 Subject: [PATCH 06/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index c8db56e..5c0b711 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,5 +1,5 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 363aeb7..343e33b 100644 +index 9b58b50..54553cf 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php @@ -15,10 +15,10 @@ function mail_init(){ @@ -7,10 +7,11 @@ index 363aeb7..343e33b 100644 $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; ++ $mail->SMTPAuth = false; $mail->Username = SMTP_MAIL; $mail->Password = SMTP_PASSWORD; - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; -+ $mail->SMTPAutoTLS = false; + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; + \ No newline at end of file From cffa3983fb8fe7510c81512a0ce8b1161cb59556 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 00:36:47 +0700 Subject: [PATCH 07/60] Upgrade --- conf/migrate_9.0.3.sql | 6 ++++++ scripts/upgrade | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 conf/migrate_9.0.3.sql diff --git a/conf/migrate_9.0.3.sql b/conf/migrate_9.0.3.sql new file mode 100644 index 0000000..b5c0fb9 --- /dev/null +++ b/conf/migrate_9.0.3.sql @@ -0,0 +1,6 @@ +ALTER TABLE `compte` +ADD `timeline_asc` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `nb_co_echoue`, +ADD `recherche` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `donateur`; + +ALTER TABLE `observation` +ADD `compteur` tinyint(1) unsigned NULL AFTER `jour_sommet`; \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index 073a118..9a240fc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -48,14 +48,24 @@ pushd "$install_dir" ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.5.sql ynh_add_config --template="../conf/migrate_7.0.6.sql" --destination="$install_dir/migrate_7.0.6.sql" ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.6.sql + ynh_add_config --template="../conf/migrate_9.0.3.sql" --destination="$install_dir/migrate_9.0.3.sql" + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_9.0.3.sql else if ynh_compare_current_package_version --comparison le --version 7.0~ynh6 then ynh_script_progression --message="7.0.6 to 8.0 database migration required, migrating" ynh_add_config --template="../conf/migrate_7.0.6.sql" --destination="$install_dir/migrate_7.0.6.sql" ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.6.sql + ynh_add_config --template="../conf/migrate_9.0.3.sql" --destination="$install_dir/migrate_9.0.3.sql" + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_9.0.3.sql else - ynh_script_progression --message="7.0.6 to 8.0 database migration not required since package > 7.0.6" + if ynh_compare_current_package_version --comparison le --version 9.0~ynh3 + then + ynh_add_config --template="../conf/migrate_9.0.3.sql" --destination="$install_dir/migrate_9.0.3.sql" + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_9.0.3.sql + else + ynh_script_progression --message="7.0.6 to 8.0 database migration not required since package > 7.0.6" + fi fi fi ynh_script_progression --message="You shouldn't see this" From 2df206d97001990d81912fdcf58fbde90591045a Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 08:50:31 +0700 Subject: [PATCH 08/60] Upgrade This reverts commit d19b7dd8f9dbdb29316c524a7b2a51f230cc1e99. Upgrade mail patch Update extra_php-fpm.conf Update patches Update main-02-static.patch Update patches Update patches Update patches Update patches Test Update manifest.toml Change order Test one file Test full of hope End lines ? Revert "Update manifest.toml" This reverts commit 210559e451ce8a01f82db555ada2725ce2fd37ff. --- conf/extra_php-fpm.conf | 8 +++++++- manifest.toml | 8 ++++---- scripts/upgrade | 2 ++ .../{main-02-static.patch => main-01.static.patch} | 2 +- .../patches/{main-01-mail.patch => main-02-mail.patch} | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) rename sources/patches/{main-02-static.patch => main-01.static.patch} (99%) rename sources/patches/{main-01-mail.patch => main-02-mail.patch} (99%) diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf index 41bfc20..9e0607d 100644 --- a/conf/extra_php-fpm.conf +++ b/conf/extra_php-fpm.conf @@ -14,4 +14,10 @@ ; Session lifetime to avoid disconnections on PWA mode php_admin_value[session.gc_maxlifetime] = 2592000 php_admin_value[session.cookie_lifetime] = 2592000 -php_value[session.save_path] = /var/www/__APP__/sessions \ No newline at end of file +php_value[session.save_path] = /var/www/__APP__/sessions + +; caching php files +php_value[opcache.enable_cli]=1 +php_value[opcache.max_accelerated_files]=100 +php_value[opcache.memory_consumption]=32M +php_value[opcache.revalidate_freq]=300 diff --git a/manifest.toml b/manifest.toml index 031ab27..6e6b449 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "9.0~ynh5" +version = "9.0~ynh6" maintainers = ["Raoul de Limezy"] @@ -34,8 +34,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/ee19dce2c74ff6e948fae98319cd00eda6ce4117.zip" - sha256 = "ef9a61dbbefa1b5c6454d893ac20b2beba773d7298d40ed47ba9c95636c35b3a" + url = "https://github.com/jean-io/moncycle.app/archive/2eaf8d5765423276f2f16816fb62218f6b311555.zip" + sha256 = "a193698c38d3d22eacbd41f9c8a1c9253748469571711c7781868521bf678da7" [resources.system_user] @@ -45,7 +45,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server, php8.2-gd, php8.2-mysql, php8.2-xml, php8.2-mbstring" + packages = "mariadb-server, php8.2-gd, php8.2-mysql, php8.2-xml, php8.2-mbstring, php8.2-opcache" [resources.database] type = "mysql" diff --git a/scripts/upgrade b/scripts/upgrade index 335f38a..302885e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,8 @@ pushd "$install_dir" ynh_exec_warn_less mv ./www_data/* . ynh_exec_warn_less mv /tmp/config.php . + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < db/demo.sql + ynh_script_progression --message="Checking if a database migration is needed" if ynh_compare_current_package_version --comparison le --version 7.0~ynh5 then diff --git a/sources/patches/main-02-static.patch b/sources/patches/main-01.static.patch similarity index 99% rename from sources/patches/main-02-static.patch rename to sources/patches/main-01.static.patch index 715ef42..c3c8904 100644 --- a/sources/patches/main-02-static.patch +++ b/sources/patches/main-01.static.patch @@ -457,4 +457,4 @@ index 73b2d83..61d675d 100644 + $statement = $db->prepare($sql); $statement->execute(); - return $statement->fetchAll(PDO::FETCH_NUM); + return $statement->fetchAll(PDO::FETCH_NUM); \ No newline at end of file diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-02-mail.patch similarity index 99% rename from sources/patches/main-01-mail.patch rename to sources/patches/main-02-mail.patch index 5c0b711..7b729a3 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-02-mail.patch @@ -14,4 +14,4 @@ index 9b58b50..54553cf 100644 + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; - \ No newline at end of file + From 10bdb4af1fabafea2a8243541724ca3b3e502f3d Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 14:36:04 +0700 Subject: [PATCH 09/60] Update main-02-mail.patch --- sources/patches/main-02-mail.patch | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sources/patches/main-02-mail.patch b/sources/patches/main-02-mail.patch index 7b729a3..ce40baa 100644 --- a/sources/patches/main-02-mail.patch +++ b/sources/patches/main-02-mail.patch @@ -1,8 +1,8 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..54553cf 100644 +index 9b58b50..ff99f07 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -15,10 +15,10 @@ function mail_init(){ +@@ -15,13 +15,13 @@ function mail_init(){ $mail->isSMTP(); $mail->Host = SMTP_HOST; @@ -14,4 +14,14 @@ index 9b58b50..54553cf 100644 + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; - +- ++ + $mail->setFrom(SMTP_MAIL, 'moncycle.app'); + return $mail; + } +@@ -105,5 +105,3 @@ function mail_body_relance ($nom, $mail1) { + + HTML; + } +- +- \ No newline at end of file From 45c67ff906262178d34800e746c75312262b0045 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 16:49:31 +0700 Subject: [PATCH 10/60] Move to php8.3 --- manifest.toml | 4 +- sources/patches/main-01.static.patch | 460 --------------------------- 2 files changed, 2 insertions(+), 462 deletions(-) delete mode 100644 sources/patches/main-01.static.patch diff --git a/manifest.toml b/manifest.toml index 6e6b449..3bc8c7b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "9.0~ynh6" +version = "9.0~ynh7" maintainers = ["Raoul de Limezy"] @@ -45,7 +45,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server, php8.2-gd, php8.2-mysql, php8.2-xml, php8.2-mbstring, php8.2-opcache" + packages = "mariadb-server, php8.3-gd, php8.3-mysql, php8.3-xml, php8.3-mbstring, php8.3-opcache" [resources.database] type = "mysql" diff --git a/sources/patches/main-01.static.patch b/sources/patches/main-01.static.patch deleted file mode 100644 index c3c8904..0000000 --- a/sources/patches/main-01.static.patch +++ /dev/null @@ -1,460 +0,0 @@ -diff --git a/www_data/lib/db.php b/www_data/lib/db.php -index 73b2d83..61d675d 100644 ---- a/www_data/lib/db.php -+++ b/www_data/lib/db.php -@@ -20,7 +20,7 @@ function db_open() { - function db_select_cycles($db, $no_compte) { - static $sql = "SELECT date_obs AS cycles FROM observation WHERE no_compte = :no_compte AND premier_jour=1 ORDER BY cycles DESC"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -30,7 +30,7 @@ function db_select_cycles($db, $no_compte) { - function db_select_grossesses($db, $no_compte) { - static $sql = "SELECT date_obs AS cycles FROM observation WHERE no_compte = :no_compte AND grossesse=1 ORDER BY cycles DESC"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -40,7 +40,7 @@ function db_select_grossesses($db, $no_compte) { - function db_select_sensations($db, $no_compte) { - static $sql = "select distinct sensation, count(sensation) as nb from observation where sensation is not null and no_compte=:no_compte group by sensation order by nb desc"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -50,7 +50,7 @@ function db_select_sensations($db, $no_compte) { - function db_select_compte_par_nocompte($db, $no_compte) { - static $sql = "select * from compte where no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -60,7 +60,7 @@ function db_select_compte_par_nocompte($db, $no_compte) { - function db_select_compte_par_mail($db, $mail) { - static $sql = "select * from compte where email1 like :email1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":email1", $mail, PDO::PARAM_STR); - $statement->execute(); - -@@ -90,7 +90,7 @@ function db_update_co_echoue($db, $mail){ - function db_select_compte_existe($db, $mail) { - static $sql = "select count(no_compte)>0 as compte_existe from compte where email1 like :email1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":email1", $mail, PDO::PARAM_STR); - $statement->execute(); - -@@ -100,7 +100,7 @@ function db_select_compte_existe($db, $mail) { - function db_insert_compte($db, $nom, $methode, $age, $mail, $mdp, $decouvert, $recherche) { - static $sql = "INSERT INTO compte (nom, methode, age, email1, motdepasse, decouvert, recherche) VALUES (:nom, :methode, :age, :email1, :motdepasse, :decouvert, :recherche)"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":nom", $nom, PDO::PARAM_STR); - $statement->bindValue(":methode", $methode, PDO::PARAM_INT); - $statement->bindValue(":age", $age, PDO::PARAM_INT); -@@ -117,9 +117,9 @@ function db_update_compte_param_str($db, $param, $value, $no_compte) { - $param_list = ["nom", "email1", "email2", "motdepasse", "totp_secret", "derniere_co_date", "inscription_date", "mdp_change_date", "decouvert"]; - if (!in_array($param, $param_list, true)) return false; - -- static $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; -+ $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":cvalue", $value, PDO::PARAM_STR); - $statement->execute(); -@@ -131,9 +131,9 @@ function db_update_compte_param_int($db, $param, $value, $no_compte) { - $param_list = ["methode", "age", "nb_co_echoue", "donateur", "actif", "relance", "timeline_asc", "recherche"]; - if (!in_array($param, $param_list, true)) return false; - -- static $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; -+ $sql = "UPDATE compte SET " . $param . " = :cvalue WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":cvalue", $value, PDO::PARAM_INT); - $statement->execute(); -@@ -144,7 +144,7 @@ function db_update_compte_param_int($db, $param, $value, $no_compte) { - function db_update_motdepasse_par_mail ($db, $mdp, $mail) { - static $sql = "UPDATE compte SET motdepasse = :motdepasse, mdp_change_date = NULL WHERE email1 = :email1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":email1", $mail, PDO::PARAM_STR); - $statement->bindValue(":motdepasse", $mdp, PDO::PARAM_STR); - $statement->execute(); -@@ -155,7 +155,7 @@ function db_update_motdepasse_par_mail ($db, $mdp, $mail) { - function db_udpate_motdepasse_par_nocompte($db, $mdp, $no_compte) { - static $sql = "UPDATE compte SET motdepasse = :motdepasse, mdp_change_date = now() WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":motdepasse", $mdp, PDO::PARAM_STR); - $statement->execute(); -@@ -166,7 +166,7 @@ function db_udpate_motdepasse_par_nocompte($db, $mdp, $no_compte) { - function db_delete_compte($db, $no_compte){ - static $sql = "DELETE FROM compte WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -176,7 +176,7 @@ function db_delete_compte($db, $no_compte){ - function db_delete_jetton($db, $no_jetton, $no_compte){ - static $sql = "DELETE FROM `jetton` WHERE `no_jetton` = :no_jetton AND `no_compte` = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_jetton", $no_jetton, PDO::PARAM_INT); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); -@@ -187,7 +187,7 @@ function db_delete_jetton($db, $no_jetton, $no_compte){ - function db_delete_observation($db, $no_compte, $date){ - static $sql = "DELETE FROM observation WHERE no_compte = :no_compte AND date_obs = :date"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":date", $date, PDO::PARAM_STR); - $statement->execute(); -@@ -198,7 +198,7 @@ function db_delete_observation($db, $no_compte, $date){ - function db_delete_vieux_jetton($db) { - static $sql = "DELETE FROM jetton WHERE (date_creation < (CURDATE() + INTERVAL - 365 DAY) OR date_use < (CURDATE() + INTERVAL - 40 DAY)) AND expire>0"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->rowCount(); -@@ -207,7 +207,7 @@ function db_delete_vieux_jetton($db) { - function db_select_all_observation($db, $no_compte) { - static $sql = "select * from observation where no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -217,7 +217,7 @@ function db_select_all_observation($db, $no_compte) { - function db_select_observation ($db, $date, $no_compte) { - static $sql = "SELECT * FROM observation WHERE date_obs = :date AND no_compte = :no_compte LIMIT 1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":date", $date, PDO::PARAM_STR); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); -@@ -228,7 +228,7 @@ function db_select_observation ($db, $date, $no_compte) { - function db_insert_observation ($db, $date, $no_compte) { - static $sql = "INSERT INTO observation (no_compte, date_obs, gommette) VALUES (:no_compte, :date, '')"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":date", $date, PDO::PARAM_STR); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); -@@ -239,7 +239,7 @@ function db_insert_observation ($db, $date, $no_compte) { - function db_update_observation ($db, $date, $no_compte, $gommette='', $note_fc=null, $fleche_fc=null, $sensation=null, $temp=null, $htemp=null, $jour_sommet=null, $union_sex=null, $premier_jour=null, $jenesaispas=null, $grossesse=null, $commentaire=null, $compteur=null) { - static $sql = "UPDATE observation SET gommette = :gommette, note_fc = :note_fc, fleche_fc = :fleche_fc, temperature = :temp, heure_temp = :htemp, sensation = :sensation, jour_sommet = :jour_sommet, union_sex = :union_sex, premier_jour = :premier_jour, jenesaispas = :jenesaispas, grossesse = :grossesse, commentaire = :commentaire, compteur = :compteur WHERE date_obs = :date AND no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":gommette", $gommette, PDO::PARAM_STR); - $statement->bindValue(":note_fc", $note_fc, PDO::PARAM_STR); - $statement->bindValue(":fleche_fc", $fleche_fc, PDO::PARAM_STR); -@@ -263,7 +263,7 @@ function db_update_observation ($db, $date, $no_compte, $gommette='', $note_fc=n - function db_select_cycle($db, $date, $no_compte) { - static $sql = "SELECT date_obs AS cycle FROM observation WHERE premier_jour=1 AND date_obs<=:date AND no_compte = :no_compte ORDER BY date_obs DESC LIMIT 1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":date", $date, PDO::PARAM_STR); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); -@@ -274,7 +274,7 @@ function db_select_cycle($db, $date, $no_compte) { - function db_select_cycle_end($db, $date, $no_compte) { - static $sql = "SELECT date_obs AS cycle_end FROM observation WHERE premier_jour=1 and date_obs>:date AND no_compte = :no_compte ORDER BY date_obs ASC LIMIT 1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":date", $date, PDO::PARAM_STR); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); -@@ -285,7 +285,7 @@ function db_select_cycle_end($db, $date, $no_compte) { - function db_select_cycle_grossesse($db, $date, $no_compte) { - static $sql = "SELECT date_obs AS grossesse FROM observation WHERE grossesse=1 and date_obs>:date AND no_compte = :no_compte ORDER BY date_obs ASC LIMIT 1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":date", $date, PDO::PARAM_STR); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); -@@ -296,7 +296,7 @@ function db_select_cycle_grossesse($db, $date, $no_compte) { - function db_select_cycle_complet($db, $date_start, $date_end, $no_compte) { - static $sql = "SELECT date_obs, COALESCE(jenesaispas,'') as '?', COALESCE(note_fc,'') as note_fc, COALESCE(fleche_fc,'') as fleche_fc, gommette, COALESCE(temperature,'') as temperature, COALESCE(heure_temp,'') as heure_temp, COALESCE(sensation,'') as sensation, COALESCE(jour_sommet, '') as sommet, COALESCE(compteur, '') as compteur, COALESCE(union_sex, '') as 'unions', COALESCE(grossesse, '') as 'grossesse', commentaire, COALESCE(premier_jour, 0) as 'premier_jour' FROM observation WHERE date_obs>=:date_start AND date_obs<=:date_end AND no_compte = :no_compte ORDER BY date_obs ASC"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":date_start", $date_start, PDO::PARAM_STR); - $statement->bindValue(":date_end", $date_end, PDO::PARAM_STR); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); -@@ -308,7 +308,7 @@ function db_select_cycle_complet($db, $date_start, $date_end, $no_compte) { - function db_select_nb_compte($db) { - static $sql = "select count(no_compte) as MONCYCLE_APP_NB_COMPTE from compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -317,7 +317,7 @@ function db_select_nb_compte($db) { - function db_select_nb_compte_actif($db) { - static $sql = "select count(distinct no_compte) as MONCYCLE_APP_NB_COMPTE_ACTIF from observation where date_obs >= DATE(NOW()) - INTERVAL 35 DAY"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -326,7 +326,7 @@ function db_select_nb_compte_actif($db) { - function db_select_nb_compte_actif_par_methode($db, $methode) { - static $sql = "select count(distinct obs.no_compte) as MONCYCLE_APP_NB_COMPTE_ACTIF_METHODE from observation as obs left join compte as com on obs.no_compte = com.no_compte where date_obs >= DATE(NOW()) - INTERVAL 35 DAY and com.methode = :methode"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":methode", $methode, PDO::PARAM_INT); - $statement->execute(); - -@@ -336,7 +336,7 @@ function db_select_nb_compte_actif_par_methode($db, $methode) { - function db_select_nb_compte_recent($db) { - static $sql = "select count(no_compte) as MONCYCLE_APP_NB_COMPTE_RECENT from compte where inscription_date >= DATE(NOW()) - INTERVAL 15 DAY and derniere_co_date is not null"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -345,7 +345,7 @@ function db_select_nb_compte_recent($db) { - function db_select_nb_cycle($db) { - static $sql = "select count(no_observation) as MONCYCLE_APP_NB_CYCLE from observation where premier_jour=1 and no_compte!=2"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -354,7 +354,7 @@ function db_select_nb_cycle($db) { - function db_select_nb_cycle_recent($db) { - static $sql = "select count(no_observation) as MONCYCLE_APP_NB_CYCLE_RECENT from observation where premier_jour=1 and date_obs>= DATE(NOW()) - INTERVAL 30 DAY and no_compte!=2"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - return $statement->fetchAll(PDO::FETCH_NUM); - } -@@ -362,7 +362,7 @@ function db_select_nb_cycle_recent($db) { - function db_select_age_moyen($db) { - static $sql = "select year(now())-avg(age)+2.5 as MONCYCLE_APP_NB_AGE_MOYEN from compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -371,7 +371,7 @@ function db_select_age_moyen($db) { - function db_select_age_moyen_recent($db) { - static $sql = "select year(now())-avg(age)+2.5 as MONCYCLE_APP_NB_AGE_MOYEN_RECENT from compte where inscription_date >= DATE(NOW()) - INTERVAL 15 DAY and derniere_co_date is not null and no_compte!=2"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -380,7 +380,7 @@ function db_select_age_moyen_recent($db) { - function db_select_total_observation_count($db) { - static $sql = "select count(no_observation) as MONCYCLE_APP_NB_OBSERVATION from observation where no_compte!=2;"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -389,7 +389,7 @@ function db_select_total_observation_count($db) { - function db_select_observation_aujourdhui($db) { - static $sql = "select count(no_observation) as MONCYCLE_APP_NB_OBSERVATION_AUJOURDHUI from observation where date_obs like DATE(NOW()) and no_compte!=2"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -398,7 +398,7 @@ function db_select_observation_aujourdhui($db) { - function db_select_observation_count($db, $nbj) { - static $sql = "select count(no_observation) as MONCYCLE_APP_NB_OBSERVATION from observation where date_obs>= DATE(NOW()) - INTERVAL :nbj DAY and no_compte!=2"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":nbj", $nbj, PDO::PARAM_INT); - $statement->execute(); - -@@ -408,7 +408,7 @@ function db_select_observation_count($db, $nbj) { - function db_select_jetton_compte($db) { - static $sql = "select count(no_jetton) as MONCYCLE_APP_NB_JETTON from jetton"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); -@@ -417,7 +417,7 @@ function db_select_jetton_compte($db) { - function db_select_cycles_recent($db) { - static $sql = "select subdate(obs.date_obs, 1) as cycle_complet, obs.no_compte as no_compte, c.nom as nom, c.methode as methode, c.email1 as email1, c.email2 as email2 from observation as obs, compte as c where obs.no_compte=c.no_compte and date_obs= DATE(NOW()) - INTERVAL 2 DAY and (premier_jour=1 or grossesse=1)"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_ASSOC); -@@ -426,7 +426,7 @@ function db_select_cycles_recent($db) { - function db_select_compte_inactif($db) { - static $sql = "select `c`.`no_compte` as `no_compte`,`c`.`nom` as `nom`,max(`o`.`dernier_modif`) as `derniere_obs_modif`,`c`.`email1` as `email1`,`c`.`email2` as `email2`,`c`.`inscription_date` as `inscription_date` from `compte` as `c` left join `observation` as `o` on `c`.`no_compte` = `o`.`no_compte` where `c`.`no_compte` != 2 and `c`.`relance`=0 group by `c`.`no_compte` having (date(`derniere_obs_modif`) < date(now()) - interval 35 DAY or `derniere_obs_modif` is null) and `inscription_date` < date(now()) - interval 35 DAY order by `derniere_obs_modif` desc limit 20"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_ASSOC); -@@ -435,7 +435,7 @@ function db_select_compte_inactif($db) { - function db_update_relance ($db, $no_compte, $relance) { - static $sql = "UPDATE compte SET relance = :relance WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":relance", $relance, PDO::PARAM_INT); - $statement->execute(); -@@ -446,7 +446,7 @@ function db_update_relance ($db, $no_compte, $relance) { - function db_insert_jetton($db, $no_compte, $nom, $pays, $jetton_str, $expire=2) { - static $sql = "INSERT INTO `jetton` (`no_compte`, `nom`, `pays`, `jetton_str`, `expire`) VALUES (:no_compte, :nom, :pays, :jetton_str, :expire)"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":expire", $expire, PDO::PARAM_INT); - $statement->bindValue(":nom", $nom, PDO::PARAM_STR); -@@ -460,7 +460,7 @@ function db_insert_jetton($db, $no_compte, $nom, $pays, $jetton_str, $expire=2) - function db_select_compte_jetton($db, $jetton_str) { - static $sql = "SELECT J.no_compte, J.no_jetton, C.nom AS nom_compte, J.pays, J.nom AS nom_jetton, J.date_creation AS d_creation_jetton, J.date_use AS d_use_jetton, C.methode, C.age, C.email1, C.email2, C.nb_co_echoue, C.donateur, C.actif, C.relance, C.derniere_co_date, C.inscription_date, C.mdp_change_date, C.decouvert, C.totp_secret, C.totp_etat, C.recherche, C.timeline_asc FROM `jetton` AS J INNER JOIN `compte` AS C ON J.no_compte=C.no_compte WHERE `jetton_str` = :jetton_str LIMIT 1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":jetton_str", $jetton_str, PDO::PARAM_STR); - $statement->execute(); - -@@ -470,7 +470,7 @@ function db_select_compte_jetton($db, $jetton_str) { - function db_select_jetton_captcha($db, $jetton_str) { - static $sql = "SELECT captcha, no_jetton FROM `jetton` WHERE `jetton_str` = :jetton_str LIMIT 1"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":jetton_str", $jetton_str, PDO::PARAM_STR); - $statement->execute(); - -@@ -480,7 +480,7 @@ function db_select_jetton_captcha($db, $jetton_str) { - function db_update_jetton_use($db, $no_jetton){ - static $sql = "UPDATE `jetton` SET `date_use` = now() WHERE `no_jetton` = :no_jetton"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_jetton", $no_jetton, PDO::PARAM_INT); - $statement->execute(); - -@@ -490,7 +490,7 @@ function db_update_jetton_use($db, $no_jetton){ - function db_update_jetton_captcha($db, $jetton_str, $captcha){ - static $sql = "UPDATE `jetton` SET `date_use` = now(), `captcha` = :captcha WHERE `jetton_str` = :jetton_str"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":jetton_str", $jetton_str, PDO::PARAM_STR); - $statement->bindValue(":captcha", $captcha, PDO::PARAM_STR); - $statement->execute(); -@@ -501,7 +501,7 @@ function db_update_jetton_captcha($db, $jetton_str, $captcha){ - function db_select_tous_les_jetton($db, $no_compte) { - static $sql = "SELECT * FROM jetton where no_compte= :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->execute(); - -@@ -511,7 +511,7 @@ function db_select_tous_les_jetton($db, $no_compte) { - function db_update_increment_cle_valeur($db, $cle){ - static $sql = "update cle_valeur set valeur = valeur+1 where cle like :cle"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":cle", $cle, PDO::PARAM_STR); - $statement->execute(); - -@@ -521,7 +521,7 @@ function db_update_increment_cle_valeur($db, $cle){ - function db_select_cle_valeur($db, $cle) { - static $sql = "select valeur from cle_valeur where cle=:cle"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":cle", $cle, PDO::PARAM_STR); - $statement->execute(); - -@@ -531,7 +531,7 @@ function db_select_cle_valeur($db, $cle) { - function db_update_reset_cle_valeur($db, $cle){ - static $sql = "update cle_valeur set valeur = 0 where cle like :cle"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":cle", $cle, PDO::PARAM_STR); - $statement->execute(); - -@@ -541,7 +541,7 @@ function db_update_reset_cle_valeur($db, $cle){ - function db_update_compte_totp_secret($db, $totp_secret, $no_compte) { - static $sql = "UPDATE compte SET totp_secret = :cvalue WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":cvalue", $totp_secret, PDO::PARAM_STR); - $statement->execute(); -@@ -552,7 +552,7 @@ function db_update_compte_totp_secret($db, $totp_secret, $no_compte) { - function db_update_compte_totp_etat($db, $totp_etat, $no_compte) { - static $sql = "UPDATE compte SET totp_etat = :cvalue WHERE no_compte = :no_compte"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->bindValue(":no_compte", $no_compte, PDO::PARAM_INT); - $statement->bindValue(":cvalue", $totp_etat, PDO::PARAM_INT); - $statement->execute(); -@@ -563,7 +563,7 @@ function db_update_compte_totp_etat($db, $totp_etat, $no_compte) { - function db_select_compte_avec_totp($db) { - static $sql = "select count(no_compte) as MONCYCLE_APP_NB_COMPTE_AVEC_TOTP from compte where totp_etat=3 and no_compte!=2"; - -- static $statement = $db->prepare($sql); -+ $statement = $db->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(PDO::FETCH_NUM); \ No newline at end of file From 030b6ef7a09ff5cd8c81c8c5d787b4525d72c3d7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 17:51:00 +0700 Subject: [PATCH 11/60] Update patch --- .../{main-02-mail.patch => main-01-mail.patch} | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) rename sources/patches/{main-02-mail.patch => main-01-mail.patch} (76%) diff --git a/sources/patches/main-02-mail.patch b/sources/patches/main-01-mail.patch similarity index 76% rename from sources/patches/main-02-mail.patch rename to sources/patches/main-01-mail.patch index ce40baa..2be4c32 100644 --- a/sources/patches/main-02-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,9 +1,12 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..ff99f07 100644 +index 9b58b50..0112cc5 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -15,13 +15,13 @@ function mail_init(){ +@@ -12,16 +12,14 @@ use PHPMailer\PHPMailer\PHPMailer; + function mail_init(){ + $mail = new PHPMailer(); +- $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; @@ -15,13 +18,6 @@ index 9b58b50..ff99f07 100644 $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; - -+ $mail->setFrom(SMTP_MAIL, 'moncycle.app'); return $mail; } -@@ -105,5 +105,3 @@ function mail_body_relance ($nom, $mail1) { - - HTML; - } -- -- \ No newline at end of file From 1a6ad64739f7555c71ef4ca8b94aa653968940e8 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 19:50:14 +0700 Subject: [PATCH 12/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 2be4c32..7b729a3 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,12 +1,9 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..0112cc5 100644 +index 9b58b50..54553cf 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -12,16 +12,14 @@ use PHPMailer\PHPMailer\PHPMailer; +@@ -15,10 +15,10 @@ function mail_init(){ - function mail_init(){ - $mail = new PHPMailer(); -- $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; @@ -17,7 +14,4 @@ index 9b58b50..0112cc5 100644 + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; -- - $mail->setFrom(SMTP_MAIL, 'moncycle.app'); - return $mail; - } + From 8e5ae01ff21a404ec7ba3adfdc1b279c967c6f13 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 19:54:02 +0700 Subject: [PATCH 13/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 7b729a3..2be4c32 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,9 +1,12 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..54553cf 100644 +index 9b58b50..0112cc5 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -15,10 +15,10 @@ function mail_init(){ +@@ -12,16 +12,14 @@ use PHPMailer\PHPMailer\PHPMailer; + function mail_init(){ + $mail = new PHPMailer(); +- $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; @@ -14,4 +17,7 @@ index 9b58b50..54553cf 100644 + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; - +- + $mail->setFrom(SMTP_MAIL, 'moncycle.app'); + return $mail; + } From 25ce95f5f75c2647ad792cb00e11800cd1ad3bcb Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 20:26:07 +0700 Subject: [PATCH 14/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 2be4c32..7b729a3 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,12 +1,9 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..0112cc5 100644 +index 9b58b50..54553cf 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -12,16 +12,14 @@ use PHPMailer\PHPMailer\PHPMailer; +@@ -15,10 +15,10 @@ function mail_init(){ - function mail_init(){ - $mail = new PHPMailer(); -- $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; @@ -17,7 +14,4 @@ index 9b58b50..0112cc5 100644 + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; -- - $mail->setFrom(SMTP_MAIL, 'moncycle.app'); - return $mail; - } + From 6bbcb64c81baf0d55590dbdfc5c8a30468c328bf Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 20:37:20 +0700 Subject: [PATCH 15/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 7b729a3..5c0b711 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -14,4 +14,4 @@ index 9b58b50..54553cf 100644 + $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; - + \ No newline at end of file From 80dfeec3fed913a35312cf621e704bcfd16110b4 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 20:55:46 +0700 Subject: [PATCH 16/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 5c0b711..441851c 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,17 +1,19 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..54553cf 100644 +index 9b58b50..1a538e6 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -15,10 +15,10 @@ function mail_init(){ +@@ -15,12 +15,12 @@ function mail_init(){ $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; -+ $mail->SMTPAuth = false; $mail->Username = SMTP_MAIL; $mail->Password = SMTP_PASSWORD; - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; -+ $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; - \ No newline at end of file ++ $mail->SMTPAuth = false; ++ $mail->SMTPSecure = false; + + $mail->setFrom(SMTP_MAIL, 'moncycle.app'); + return $mail; \ No newline at end of file From 887b4441e4c11da069c2d26e14c8ea56de1f6d8a Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 21:00:42 +0700 Subject: [PATCH 17/60] Update main-01-mail.patch --- sources/patches/main-01-mail.patch | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 441851c..4936806 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -4,16 +4,16 @@ index 9b58b50..1a538e6 100644 +++ b/www_data/lib/mail.php @@ -15,12 +15,12 @@ function mail_init(){ - $mail->isSMTP(); - $mail->Host = SMTP_HOST; -- $mail->SMTPAuth = true; - $mail->Username = SMTP_MAIL; - $mail->Password = SMTP_PASSWORD; -- $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; - $mail->Port = SMTP_PORT; - $mail->CharSet = 'UTF-8'; -+ $mail->SMTPAuth = false; -+ $mail->SMTPSecure = false; + $mail->isSMTP(); + $mail->Host = SMTP_HOST; +- $mail->SMTPAuth = true; + $mail->Username = SMTP_MAIL; + $mail->Password = SMTP_PASSWORD; +- $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; + $mail->Port = SMTP_PORT; + $mail->CharSet = 'UTF-8'; ++ $mail->SMTPAuth = false; ++ $mail->SMTPSecure = false; - $mail->setFrom(SMTP_MAIL, 'moncycle.app'); - return $mail; \ No newline at end of file + $mail->setFrom(SMTP_MAIL, 'moncycle.app'); + return $mail; \ No newline at end of file From d9d4b21b79f59dbf58cb4ff22899c5f5d255fcd7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 22:23:05 +0700 Subject: [PATCH 18/60] Add version --- conf/version.json | 6 ++++++ scripts/install | 2 ++ scripts/upgrade | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 conf/version.json diff --git a/conf/version.json b/conf/version.json new file mode 100644 index 0000000..e2efcc5 --- /dev/null +++ b/conf/version.json @@ -0,0 +1,6 @@ +{ + "app": "moncycle.app", + "version": "9.0~ynh7", + "build": "2024-02-19", + "commit": "2eaf8d5" +} \ No newline at end of file diff --git a/scripts/install b/scripts/install index 45d3600..e4ee868 100755 --- a/scripts/install +++ b/scripts/install @@ -69,6 +69,8 @@ ynh_add_config --template="../conf/config.php" --destination="$install_dir/confi chmod 400 "$install_dir/config.php" chown $app:$app "$install_dir/config.php" +ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 302885e..7f21c37 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -113,6 +113,8 @@ ynh_add_config --template="../conf/config.php" --destination="$install_dir/confi chmod 400 "$install_dir/config.php" chown $app:$app "$install_dir/config.php" +ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" + #================================================= # END OF SCRIPT #================================================= From 2b8b95bb91bfbd702c33c199d3da09a8a87608f0 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 22:29:19 +0700 Subject: [PATCH 19/60] Try config panel --- config_panel.toml | 8 ++ config_panel.toml.example | 295 -------------------------------------- 2 files changed, 8 insertions(+), 295 deletions(-) create mode 100644 config_panel.toml delete mode 100644 config_panel.toml.example diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..7bd938d --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,8 @@ +version = "1.0" +[main] + [main.main] + [main.main.CREATION_COMPTE] + ask.en = "Création de comptes" + type = "select" + choices = ["true", "false"] + bind = ":__INSTALL_DIR__/config.php" \ No newline at end of file diff --git a/config_panel.toml.example b/config_panel.toml.example deleted file mode 100644 index c6bccd8..0000000 --- a/config_panel.toml.example +++ /dev/null @@ -1,295 +0,0 @@ - -## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button -## Those panels let user configure some params on their apps using a friendly interface, -## and remove the need to manually edit files from the command line. - -## From a packager perspective, this .toml is coupled to the scripts/config script, -## which may be used to define custom getters/setters. However, most use cases -## should be covered automagically by the core, thus it may not be necessary -## to define a scripts/config at all! - -## ----------------------------------------------------------------------------- -## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and -## do not overwhelm the admin with tons of misunderstandable or advanced settings. -## ----------------------------------------------------------------------------- - -## The top level describe the entire config panels screen. - -## The version is a required property. -## Here a small reminder to associate config panel version with YunoHost version -## | Config | YNH | Config panel small change log | -## | ------ | --- | ------------------------------------------------------- | -## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 | -## | 1.0 | 4.3.x | The new config panel system with 'bind' property | -version = "1.0" - -## (optional) i18n property let you internationalize questions, however this feature -## is only available in core configuration panel (like yunohost domain config). -## So in app config panel this key is ignored for now, but you can internationalize -## by using a lang dictionary (see property name bellow) -# i18n = "prefix_translation_key" - -################################################################################ -#### ABOUT PANELS -################################################################################ - -## The next level describes web admin panels -## You have to choose an ID for each panel, in this example the ID is "main" -## Keep in mind this ID will be used in CLI to refer to your question, so choose -## something short and meaningfull. -## In the webadmin, each panel corresponds to a distinct tab / form -[main] - -## Define the label for your panel -## Internationalization works similarly to the 'description' and 'ask' questions in the manifest -# name.en = "Main configuration" -# name.fr = "Configuration principale" - -## (optional) If you need to trigger a service reload-or-restart after the user -## change a question in this panel, you can add your service in the list. -services = ["__APP__"] -# or services = ["nginx", "__APP__"] to also reload-or-restart nginx - -## (optional) This help properties is a short help displayed on the same line -## than the panel title but not displayed in the tab. -# help = "" - - ############################################################################ - #### ABOUT SECTIONS - ############################################################################ - - ## A panel is composed of one or several sections. - ## - ## Sections are meant to group questions together when they correspond to - ## a same subtopic. This impacts the rendering in terms of CLI prompts - ## and HTML forms - ## - ## You should choose an ID for your section, and prefix it with the panel ID - ## (Be sure to not make a typo in the panel ID, which would implicitly create - ## an other entire panel) - ## - ## We use the context of pepettes_ynh as an example, - ## which is a simple donation form app written in python, - ## and for which the admin will want to edit the configuration - [main.customization] - - ## (optional) Defining a proper title for sections is not mandatory - ## and depends on the exact rendering you're aiming for the CLI / webadmin - name = "" - - ## (optional) This help properties is a short help displayed on the same line - ## than the section title, meant to provide additional details - # help = "" - - ## (optional) As for panel, you can specify to trigger a service - ## reload-or-restart after the user change a question in this section. - ## This property is added to the panel property, it doesn't deactivate it. - ## So no need to replicate, the service list from panel services property. - # services = [] - - ## (optional) By default all questions are optionals, but you can specify a - ## default behaviour for question in the section - optional = false - - ## (optional) It's also possible with the 'visible' property to only - ## display the section depending on the user's answers to previous questions. - ## - ## Be careful that the 'visible' property should only refer to **previous** questions - ## Hence, it should not make sense to have a "visible" property on the very first section. - ## - ## Also, keep in mind that this feature only works in the webadmin and not in CLI - ## (therefore a user could be prompted in CLI for a question that may not be relevant) - # visible = true - - ######################################################################## - #### ABOUT QUESTIONS - ######################################################################## - - ## A section is compound of one or several questions. - - ## --------------------------------------------------------------------- - ## IMPORTANT: as for panel and section you have to choose an ID, but this - ## one should be unique in all this document, even if the question is in - ## an other panel. - ## --------------------------------------------------------------------- - - ## You can use same questions types and properties than in manifest.yml - ## install part. However, in YNH 4.3, a lot of change has been made to - ## extend availables questions types list. - ## See: TODO DOC LINK - - [main.customization.project_name] - - ## (required) The ask property is equivalent to the ask property in - ## the manifest. However, in config panels, questions are displayed on the - ## left side and therefore have less space to be rendered. Therefore, - ## it is better to use a short question, and use the "help" property to - ## provide additional details if necessary. - ask.en = "Name of the project" - - ## (required) The type property indicates how the question should be - ## displayed, validated and managed. Some types have specific properties. - ## - ## Types available: string, boolean, number, range, text, password, path - ## email, url, date, time, color, select, domain, user, tags, file. - ## - ## For a complete list with specific properties, see: TODO DOC LINK - type = "string" - - ######################################################################## - #### ABOUT THE BIND PROPERTY - ######################################################################## - - ## (recommended) 'bind' property is a powerful feature that let you - ## configure how and where the data will be read, validated and written. - - ## By default, 'bind property is in "settings" mode, it means it will - ## **only** read and write the value in application settings file. - ## bind = "settings" - - ## However, settings usually correspond to key/values in actual app configurations - ## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost - ## will automagically find a line with "KEY=VALUE" in FILENAME - ## (with the adequate separator between KEY and VALUE) - ## - ## YunoHost will then use this value for the read/get operation. - ## During write/set operations, YunoHost will overwrite the value - ## in **both** FILENAME and in the app's settings.yml - - ## Configuration file format supported: yaml, toml, json, ini, env, php, - ## python. The feature probably works with others formats, but should be tested carefully. - - ## Note that this feature only works with relatively simple cases - ## such as `KEY: VALUE`, but won't properly work with - ## complex data structures like multilin array/lists or dictionnaries. - ## It also doesn't work with XML format, custom config function call, php define(), ... - - ## More info on TODO - # bind = ":/var/www/__APP__/settings.py" - - - ## By default, bind = ":FILENAME" will use the question ID as KEY - ## ... but the question ID may sometime not be the exact KEY name in the configuration file. - ## - ## In particular, in pepettes, the python variable is 'name' and not 'project_name' - ## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 ) - ## - ## In that case, the key name can be specified before the column ':' - - bind = "name:/var/www/__APP__/settings.py" - - ## --------------------------------------------------------------------- - ## IMPORTANT: other 'bind' mode exists: - ## - ## bind = "FILENAME" (with no column character before FILENAME) - ## may be used to bind to the **entire file content** (instead of a single KEY/VALUE) - ## This could be used to expose an entire configuration file, or binary files such as images - ## For example: - ## bind = "/var/www/__APP__/img/logo.png" - ## - ## bind = "null" can be used to disable reading / writing in settings. - ## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting - ## In this mode, you are expected to define custom getter/setters/validators in scripts/config: - ## - ## getter: get__QUESTIONID() - ## setter: set__QUESTIONID() - ## validator: validate__QUESTIONID() - ## - ## You can also specify a common getter / setter / validator, with the - ## function 'bind' mode, for example here it will try to run - ## get__array_settings() first. - # bind = "array_settings()" - ## --------------------------------------------------------------------- - - ## --------------------------------------------------------------------- - ## IMPORTANT: with the exception of bind=null questions, - ## question IDs should almost **always** correspond to an app setting - ## initialized / reused during install/upgrade. - ## Not doing so may result in inconsistencies between the config panel mechanism - ## and the use of ynh_add_config - ## --------------------------------------------------------------------- - - ######################################################################## - #### OTHER GENERIC PROPERTY FOR QUESTIONS - ######################################################################## - - ## (optional) An help text for the question - help = "Fill the name of the project which will received donation" - - ## (optional) An example display as placeholder in web form - # example = "YunoHost" - - ## (optional) set to true in order to redact the value in operation logs - # redact = false - - ## (optional) A validation pattern - ## --------------------------------------------------------------------- - ## IMPORTANT: your pattern should be between simple quote, not double. - ## --------------------------------------------------------------------- - pattern.regexp = '^\w{3,30}$' - pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted" - - ## Note: visible and optional properties are also available for questions - - - [main.customization.contact_url] - ask = "Contact url" - type = "url" - example = "mailto: contact@example.org" - help = "mailto: accepted" - pattern.regexp = '^mailto:[^@]+@[^@]+|https://$' - pattern.error = "Should be https or mailto:" - bind = ":/var/www/__APP__/settings.py" - - [main.customization.logo] - ask = "Logo" - type = "file" - accept = ".png" - help = "Fill with an already resized logo" - bind = "__FINALPATH__/img/logo.png" - - [main.customization.favicon] - ask = "Favicon" - type = "file" - accept = ".png" - help = "Fill with an already sized favicon" - bind = "__FINALPATH__/img/favicon.png" - - - [main.stripe] - name = "Stripe general info" - optional = false - - # The next alert is overwrited with a getter from the config script - [main.stripe.amount] - ask = "Donation in the month : XX € - type = "alert" - style = "success" - - [main.stripe.publishable_key] - ask = "Publishable key" - type = "string" - redact = true - help = "Indicate here the stripe publishable key" - bind = ":/var/www/__APP__/settings.py" - - [main.stripe.secret_key] - ask = "Secret key" - type = "string" - redact = true - help = "Indicate here the stripe secret key" - bind = ":/var/www/__APP__/settings.py" - - [main.stripe.prices] - ask = "Prices ID" - type = "tags" - help = """\ - Indicates here the prices ID of donation products you created in stripe interfaces. \ - Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \ - Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \ - FREQUENCY: 'one_time' or 'recuring' \ - CURRENCY: 'EUR' or 'USD' \ - PRICE_ID: ID from stripe interfaces starting with 'price_' \ - """ - pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$' - pattern.error = "Please respect the format describe in help text for each price ID" From 20ecdbc9a26964fd06ca2c5f47387423bbc4085a Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 22:30:04 +0700 Subject: [PATCH 20/60] Update POST_INSTALL.md --- doc/POST_INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 00f1c19..f268c09 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,4 +1,4 @@ * After installing, you can create your own user using the form -* Once done, you can (if you want) set the account creation to false in `__INSTALL_DIR__/config.php` +* Once done, you can (if you want) set the account creation to false in the config panel * If you want to use the app in PWA mode, be sure to be connected to your account first * After upgrading from 7.0 to 9.0, you may experience issues if you don't clean your browser cache From e2602fdade6fdcf560e5641d1d60c843027defcc Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 22:32:03 +0700 Subject: [PATCH 21/60] Update nginx.conf --- conf/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index bd9dca4..3eaaba4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,6 +26,7 @@ location __PATH__/ { } # Default indexes and catch-all + rewrite ^/api/version /api/version.json; rewrite ^/(connexion|compte)$ /$1.php; rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2; index index.php index.html; From 10af942ad1e7a5a878ffe4515b8b1aa7e1da3119 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 22:47:14 +0700 Subject: [PATCH 22/60] Test --- conf/nginx.conf | 2 +- manifest.toml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3eaaba4..cbb1f01 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,8 +26,8 @@ location __PATH__/ { } # Default indexes and catch-all - rewrite ^/api/version /api/version.json; rewrite ^/(connexion|compte)$ /$1.php; + rewrite ^/api/version$ /api/version.json last; rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2; index index.php index.html; try_files $uri $uri/ $uri.php?$args; diff --git a/manifest.toml b/manifest.toml index 3bc8c7b..f168d0a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -32,6 +32,13 @@ ram.runtime = "50M" [install.init_main_permission] type = "group" + [install.CREATION_COMPTE] + ask.en = "Can accounts be created ?" + ask.fr = "Laisser la création de nouveaux comptes ouverte ?" + type = "select" + choices = ["true", "false"] + default = "true" + [resources] [resources.sources.main] url = "https://github.com/jean-io/moncycle.app/archive/2eaf8d5765423276f2f16816fb62218f6b311555.zip" From 6c7200c84ca0fec3859c7fc386244f9c0a119235 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 22:58:52 +0700 Subject: [PATCH 23/60] Config panel --- config_panel.toml | 12 +++++++----- manifest.toml | 10 +++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 7bd938d..49dae20 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,8 +1,10 @@ version = "1.0" [main] - [main.main] - [main.main.CREATION_COMPTE] - ask.en = "Création de comptes" - type = "select" - choices = ["true", "false"] +name = "Moncycle.app configuration" + [main.comptes] + name = "comptes" + [main.comptes.CREATION_COMPTE] + ask.en = "Enable account creation" + type = "boolean" + default = "true" bind = ":__INSTALL_DIR__/config.php" \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index f168d0a..ed6360f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -32,13 +32,6 @@ ram.runtime = "50M" [install.init_main_permission] type = "group" - [install.CREATION_COMPTE] - ask.en = "Can accounts be created ?" - ask.fr = "Laisser la création de nouveaux comptes ouverte ?" - type = "select" - choices = ["true", "false"] - default = "true" - [resources] [resources.sources.main] url = "https://github.com/jean-io/moncycle.app/archive/2eaf8d5765423276f2f16816fb62218f6b311555.zip" @@ -56,3 +49,6 @@ ram.runtime = "50M" [resources.database] type = "mysql" + + [main.main.CREATION_COMPTE] + CREATION_COMPTE="true" From 5ec23c420024d4d3df1b0242d7db5e8119edc8f0 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 23:05:11 +0700 Subject: [PATCH 24/60] Update nginx.conf --- conf/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index cbb1f01..ce639c5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -27,8 +27,8 @@ location __PATH__/ { # Default indexes and catch-all rewrite ^/(connexion|compte)$ /$1.php; - rewrite ^/api/version$ /api/version.json last; - rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2; + rewrite ^/api/version$ /api/version.json; + rewrite ^/api/([a-zA-Z0-9_^\.]+)(\?.*)?$ /api/$1.php$2; index index.php index.html; try_files $uri $uri/ $uri.php?$args; From 0b18bbbe684d40aa85b12fa83c914dc3cffac392 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 20 Feb 2024 23:13:42 +0700 Subject: [PATCH 25/60] version should work now --- conf/version.json | 2 +- scripts/install | 3 +++ scripts/upgrade | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conf/version.json b/conf/version.json index e2efcc5..c38e093 100644 --- a/conf/version.json +++ b/conf/version.json @@ -3,4 +3,4 @@ "version": "9.0~ynh7", "build": "2024-02-19", "commit": "2eaf8d5" -} \ No newline at end of file +} diff --git a/scripts/install b/scripts/install index e4ee868..80807b2 100755 --- a/scripts/install +++ b/scripts/install @@ -71,6 +71,9 @@ chown $app:$app "$install_dir/config.php" ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" +chmod 400 "$install_dir/api/version.json" +chown $app:www-data "$install_dir/api/version.json" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7f21c37..99c7a9d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -115,6 +115,9 @@ chown $app:$app "$install_dir/config.php" ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" +chmod 400 "$install_dir/api/version.json" +chown $app:www-data "$install_dir/api/version.json" + #================================================= # END OF SCRIPT #================================================= From a853eb6f00df50df259ad151249308dc799b0775 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 00:06:15 +0700 Subject: [PATCH 26/60] Update nginx.conf --- conf/nginx.conf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index ce639c5..d4b5734 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -25,10 +25,13 @@ location __PATH__/ { access_log off; } + location /api/version { + rewrite ^/api/version$ /api/version.json; + } + # Default indexes and catch-all rewrite ^/(connexion|compte)$ /$1.php; - rewrite ^/api/version$ /api/version.json; - rewrite ^/api/([a-zA-Z0-9_^\.]+)(\?.*)?$ /api/$1.php$2; + rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2; index index.php index.html; try_files $uri $uri/ $uri.php?$args; From 80d4abc84780a8141736bc781da8553d585eba19 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 00:19:46 +0700 Subject: [PATCH 27/60] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d4b5734..c6ba849 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -25,7 +25,7 @@ location __PATH__/ { access_log off; } - location /api/version { + location ~ ^/api/version { rewrite ^/api/version$ /api/version.json; } From 8f8191edd54707a8586b302abc822e1fa7d57060 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 00:21:23 +0700 Subject: [PATCH 28/60] rights --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 80807b2..dd8b95d 100755 --- a/scripts/install +++ b/scripts/install @@ -71,7 +71,7 @@ chown $app:$app "$install_dir/config.php" ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" -chmod 400 "$install_dir/api/version.json" +chmod 655 "$install_dir/api/version.json" chown $app:www-data "$install_dir/api/version.json" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 99c7a9d..5de5f64 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -115,7 +115,7 @@ chown $app:$app "$install_dir/config.php" ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" -chmod 400 "$install_dir/api/version.json" +chmod 655 "$install_dir/api/version.json" chown $app:www-data "$install_dir/api/version.json" #================================================= From b9b43d1455cb0ff60103d23719c68909b90319af Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 10:00:58 +0700 Subject: [PATCH 29/60] Update to v10 --- conf/config.php | 2 ++ conf/version.json | 6 +++--- manifest.toml | 6 +++--- sources/patches/main-01-mail.patch | 16 ++++++++++------ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/conf/config.php b/conf/config.php index 04f2655..f4ced39 100644 --- a/conf/config.php +++ b/conf/config.php @@ -25,3 +25,5 @@ define("CONNEXION_COMPTE", true); define("CSV_SEP", ";"); +define("PHP_SECURE_COOKIES", true); + diff --git a/conf/version.json b/conf/version.json index c38e093..38a35cc 100644 --- a/conf/version.json +++ b/conf/version.json @@ -1,6 +1,6 @@ { "app": "moncycle.app", - "version": "9.0~ynh7", - "build": "2024-02-19", - "commit": "2eaf8d5" + "version": "10.0~ynh1", + "build": "2024-02-20", + "commit": "31f2dd5" } diff --git a/manifest.toml b/manifest.toml index ed6360f..4bfda05 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "9.0~ynh7" +version = "10.0~ynh1" maintainers = ["Raoul de Limezy"] @@ -34,8 +34,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/2eaf8d5765423276f2f16816fb62218f6b311555.zip" - sha256 = "a193698c38d3d22eacbd41f9c8a1c9253748469571711c7781868521bf678da7" + url = "https://github.com/jean-io/moncycle.app/archive/31f2dd5272d617de30ee58e79052b3af7ae5b5d4.zip" + sha256 = "7f8fd2f7b28c16a308a67f476b34f2797b10a8f6285c36aa71b6876b845baf80" [resources.system_user] diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-01-mail.patch index 4936806..0e2a784 100644 --- a/sources/patches/main-01-mail.patch +++ b/sources/patches/main-01-mail.patch @@ -1,19 +1,23 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index 9b58b50..1a538e6 100644 +index 9b58b50..0112cc5 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php -@@ -15,12 +15,12 @@ function mail_init(){ +@@ -12,16 +12,14 @@ use PHPMailer\PHPMailer\PHPMailer; + function mail_init(){ + $mail = new PHPMailer(); +- $mail->isSMTP(); $mail->Host = SMTP_HOST; - $mail->SMTPAuth = true; ++ $mail->SMTPAuth = false; $mail->Username = SMTP_MAIL; $mail->Password = SMTP_PASSWORD; - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; ++ $mail->SMTPSecure = false; $mail->Port = SMTP_PORT; $mail->CharSet = 'UTF-8'; -+ $mail->SMTPAuth = false; -+ $mail->SMTPSecure = false; - +- $mail->setFrom(SMTP_MAIL, 'moncycle.app'); - return $mail; \ No newline at end of file + return $mail; + } \ No newline at end of file From b273c4e25b628fe58e31c11fbfaa7addfe7a5c21 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 10:18:06 +0700 Subject: [PATCH 30/60] No config panel for now --- config_panel.toml => config_panel.toml.example | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config_panel.toml => config_panel.toml.example (100%) diff --git a/config_panel.toml b/config_panel.toml.example similarity index 100% rename from config_panel.toml rename to config_panel.toml.example From 673c559a44b24e90ccc3bb40430645cafb073379 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 11:29:13 +0700 Subject: [PATCH 31/60] Fix small CI warning --- sources/patches/main-01-remove-version.patch | 12 ++++++++++++ .../{main-01-mail.patch => main-02-mail.patch} | 0 2 files changed, 12 insertions(+) create mode 100644 sources/patches/main-01-remove-version.patch rename sources/patches/{main-01-mail.patch => main-02-mail.patch} (100%) diff --git a/sources/patches/main-01-remove-version.patch b/sources/patches/main-01-remove-version.patch new file mode 100644 index 0000000..097361d --- /dev/null +++ b/sources/patches/main-01-remove-version.patch @@ -0,0 +1,12 @@ +diff --git a/www_data/api/version.json b/www_data/api/version.json +deleted file mode 100644 +index 3b8a410..0000000 +--- a/www_data/api/version.json ++++ /dev/null +@@ -1,6 +0,0 @@ +-{ +- "app": "moncycle.app", +- "version": "dev", +- "build": "YYYY-MM-DD", +- "commit": "xxxxxxxx" +-} \ No newline at end of file diff --git a/sources/patches/main-01-mail.patch b/sources/patches/main-02-mail.patch similarity index 100% rename from sources/patches/main-01-mail.patch rename to sources/patches/main-02-mail.patch From c89dc612a76a525bec303d4156e939bd1492e318 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 11:39:27 +0700 Subject: [PATCH 32/60] Update main-01-remove-version.patch --- sources/patches/main-01-remove-version.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/patches/main-01-remove-version.patch b/sources/patches/main-01-remove-version.patch index 097361d..b6452d1 100644 --- a/sources/patches/main-01-remove-version.patch +++ b/sources/patches/main-01-remove-version.patch @@ -5,8 +5,8 @@ index 3b8a410..0000000 +++ /dev/null @@ -1,6 +0,0 @@ -{ -- "app": "moncycle.app", -- "version": "dev", -- "build": "YYYY-MM-DD", -- "commit": "xxxxxxxx" +- "app": "moncycle.app", +- "version": "dev", +- "build": "YYYY-MM-DD", +- "commit": "xxxxxxxx" -} \ No newline at end of file From 438a83ae127e5ce39f132e6593badb7c3f44d348 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:06:06 +0700 Subject: [PATCH 33/60] Revert "Update main-01-remove-version.patch" This reverts commit c89dc612a76a525bec303d4156e939bd1492e318. --- sources/patches/main-01-remove-version.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/patches/main-01-remove-version.patch b/sources/patches/main-01-remove-version.patch index b6452d1..097361d 100644 --- a/sources/patches/main-01-remove-version.patch +++ b/sources/patches/main-01-remove-version.patch @@ -5,8 +5,8 @@ index 3b8a410..0000000 +++ /dev/null @@ -1,6 +0,0 @@ -{ -- "app": "moncycle.app", -- "version": "dev", -- "build": "YYYY-MM-DD", -- "commit": "xxxxxxxx" +- "app": "moncycle.app", +- "version": "dev", +- "build": "YYYY-MM-DD", +- "commit": "xxxxxxxx" -} \ No newline at end of file From 2e485ceba5d0719eea5f877a7c286b5a89412544 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:06:14 +0700 Subject: [PATCH 34/60] Revert "Fix small CI warning" This reverts commit 673c559a44b24e90ccc3bb40430645cafb073379. --- .../{main-02-mail.patch => main-01-mail.patch} | 0 sources/patches/main-01-remove-version.patch | 12 ------------ 2 files changed, 12 deletions(-) rename sources/patches/{main-02-mail.patch => main-01-mail.patch} (100%) delete mode 100644 sources/patches/main-01-remove-version.patch diff --git a/sources/patches/main-02-mail.patch b/sources/patches/main-01-mail.patch similarity index 100% rename from sources/patches/main-02-mail.patch rename to sources/patches/main-01-mail.patch diff --git a/sources/patches/main-01-remove-version.patch b/sources/patches/main-01-remove-version.patch deleted file mode 100644 index 097361d..0000000 --- a/sources/patches/main-01-remove-version.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/www_data/api/version.json b/www_data/api/version.json -deleted file mode 100644 -index 3b8a410..0000000 ---- a/www_data/api/version.json -+++ /dev/null -@@ -1,6 +0,0 @@ --{ -- "app": "moncycle.app", -- "version": "dev", -- "build": "YYYY-MM-DD", -- "commit": "xxxxxxxx" --} \ No newline at end of file From 50d539ee4e3ad644b54a08e956fb286dc8e274b4 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:10:19 +0700 Subject: [PATCH 35/60] Fix version.json upgrade --- scripts/install | 2 -- scripts/upgrade | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index dd8b95d..7b55452 100755 --- a/scripts/install +++ b/scripts/install @@ -65,12 +65,10 @@ chmod 644 "/etc/cron.d/$app" ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.php" --destination="$install_dir/config.php" - chmod 400 "$install_dir/config.php" chown $app:$app "$install_dir/config.php" ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" - chmod 655 "$install_dir/api/version.json" chown $app:www-data "$install_dir/api/version.json" diff --git a/scripts/upgrade b/scripts/upgrade index 5de5f64..c63e47b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -113,8 +113,9 @@ ynh_add_config --template="../conf/config.php" --destination="$install_dir/confi chmod 400 "$install_dir/config.php" chown $app:$app "$install_dir/config.php" +# Remove old version file and replace it +ynh_secure_remove --file="$install_dir/api/version.json" ynh_add_config --template="../conf/version.json" --destination="$install_dir/api/version.json" - chmod 655 "$install_dir/api/version.json" chown $app:www-data "$install_dir/api/version.json" From e2d164e60ac41a7430769331d0259702545b9d24 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:27:12 +0700 Subject: [PATCH 36/60] Test config panel --- conf/config.php | 6 +++--- config_panel.toml | 24 ++++++++++++++++++++++++ config_panel.toml.example | 10 ---------- 3 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 config_panel.toml delete mode 100644 config_panel.toml.example diff --git a/conf/config.php b/conf/config.php index f4ced39..1f8ea46 100644 --- a/conf/config.php +++ b/conf/config.php @@ -20,10 +20,10 @@ define("SMTP_PORT", 25); define("SMTP_MAIL", "__APP__@__DOMAIN__"); define("SMTP_PASSWORD", ""); -define("CREATION_COMPTE", true); -define("CONNEXION_COMPTE", true); +define("CREATION_COMPTE", __CREATION_COMPTE__); +define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); -define("CSV_SEP", ";"); +define("CSV_SEP", "__SEPARATEUR_CSV__"); define("PHP_SECURE_COOKIES", true); diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..1486a8d --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,24 @@ +version = "1.0" +[main] +name = "Moncycle.app configuration" + [main.comptes] + name = "comptes" + [main.comptes.creation_compte] + ask.en = "Enable account creation" + ask.fr = "Permettre la création de nouveaux comptes" + type = "boolean" + default = "true" + bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" + [main.comptes.connexion_compte] + ask.en = "Enable account connexion" + ask.fr = "Permettre la connexion aux comptes" + type = "boolean" + default = "true" + bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" + [main.export] + name = "export" + [main.export.separateur_csv] + ask.en = "Separator for data export in csv format" + ask.fr = "Séparateur pour l'export des données au format csv" + type = "string" + default = ";" \ No newline at end of file diff --git a/config_panel.toml.example b/config_panel.toml.example deleted file mode 100644 index 49dae20..0000000 --- a/config_panel.toml.example +++ /dev/null @@ -1,10 +0,0 @@ -version = "1.0" -[main] -name = "Moncycle.app configuration" - [main.comptes] - name = "comptes" - [main.comptes.CREATION_COMPTE] - ask.en = "Enable account creation" - type = "boolean" - default = "true" - bind = ":__INSTALL_DIR__/config.php" \ No newline at end of file From f7e4dbf49239fc688636ab547826dc4d57251f78 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:29:25 +0700 Subject: [PATCH 37/60] Update config_panel.toml --- config_panel.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index 1486a8d..5f25655 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -21,4 +21,5 @@ name = "Moncycle.app configuration" ask.en = "Separator for data export in csv format" ask.fr = "Séparateur pour l'export des données au format csv" type = "string" - default = ";" \ No newline at end of file + default = ";" + bind = "SEPARATEUR_CSV:__INSTALL_DIR__/config.php" \ No newline at end of file From 5f2d8d0138998eafc8015c7b3e25c357cb999729 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:32:14 +0700 Subject: [PATCH 38/60] Update install --- scripts/install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index 7b55452..1ffd586 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,10 @@ source _common.sh source /usr/share/yunohost/helpers +creation_compte = true +connexion_compte = true +separateur_csv = ";" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From 0948a3a376a220c56ca338a0b644a37b3570252c Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:33:42 +0700 Subject: [PATCH 39/60] Update install --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 1ffd586..72b69e7 100755 --- a/scripts/install +++ b/scripts/install @@ -9,9 +9,9 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte = true -connexion_compte = true -separateur_csv = ";" +$creation_compte = true +$connexion_compte = true +$separateur_csv = ";" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From e73043f074492a0d80ff0400f221c9ffb528e256 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:36:08 +0700 Subject: [PATCH 40/60] Update install --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 72b69e7..588f88f 100755 --- a/scripts/install +++ b/scripts/install @@ -9,9 +9,9 @@ source _common.sh source /usr/share/yunohost/helpers -$creation_compte = true -$connexion_compte = true -$separateur_csv = ";" +creation_compte=true +connexion_compte=true +separateur_csv=";" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From a715019006241e3640e51ec94a59be41c629a84c Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:39:30 +0700 Subject: [PATCH 41/60] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 588f88f..99c0c1d 100755 --- a/scripts/install +++ b/scripts/install @@ -9,8 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte=true -connexion_compte=true +creation_compte=1 +connexion_compte=1 separateur_csv=";" #================================================= From 71a022f34b49b3e0788e143a4154627465f96d37 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:43:10 +0700 Subject: [PATCH 42/60] Test --- config_panel.toml | 5 +++++ scripts/install | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 5f25655..cc4db13 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -8,12 +8,17 @@ name = "Moncycle.app configuration" ask.fr = "Permettre la création de nouveaux comptes" type = "boolean" default = "true" + yes = "true" + no = "false" + help = "Don't disable account creation before creating one for yourself !" bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" [main.comptes.connexion_compte] ask.en = "Enable account connexion" ask.fr = "Permettre la connexion aux comptes" type = "boolean" default = "true" + yes = "true" + no = "false" bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" [main.export] name = "export" diff --git a/scripts/install b/scripts/install index 99c0c1d..5e5bac7 100755 --- a/scripts/install +++ b/scripts/install @@ -9,8 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte=1 -connexion_compte=1 +creation_compte="true" +connexion_compte="true" separateur_csv=";" #================================================= From 6eb45a5dfadb8c3bd0c50383de462ec7381d2a8e Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:48:33 +0700 Subject: [PATCH 43/60] Update install --- scripts/install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index 5e5bac7..22d8027 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,10 @@ creation_compte="true" connexion_compte="true" separateur_csv=";" +ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +ynh_app_setting_set --app=$app --key=separateur_csv --value=$separateur_csv + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From ad1e0755207868aa04b4eb028b6a9eac6f9717fb Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:01:54 +0700 Subject: [PATCH 44/60] Test --- config_panel.toml | 5 +++++ scripts/install | 4 ++-- scripts/upgrade | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index cc4db13..df8c071 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,8 +1,10 @@ version = "1.0" [main] name = "Moncycle.app configuration" + [main.comptes] name = "comptes" + [main.comptes.creation_compte] ask.en = "Enable account creation" ask.fr = "Permettre la création de nouveaux comptes" @@ -12,6 +14,7 @@ name = "Moncycle.app configuration" no = "false" help = "Don't disable account creation before creating one for yourself !" bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" + [main.comptes.connexion_compte] ask.en = "Enable account connexion" ask.fr = "Permettre la connexion aux comptes" @@ -20,8 +23,10 @@ name = "Moncycle.app configuration" yes = "true" no = "false" bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" + [main.export] name = "export" + [main.export.separateur_csv] ask.en = "Separator for data export in csv format" ask.fr = "Séparateur pour l'export des données au format csv" diff --git a/scripts/install b/scripts/install index 22d8027..357c0ab 100755 --- a/scripts/install +++ b/scripts/install @@ -9,8 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte="true" -connexion_compte="true" +creation_compte=true +connexion_compte=true separateur_csv=";" ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte diff --git a/scripts/upgrade b/scripts/upgrade index c63e47b..036ce37 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,24 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) +# If creation_compte doesn't exist, create it +if [ -z "${creation_compte:-}" ]; then + creation_compte=true + ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +fi + +# If connexion_compte doesn't exist, create it +if [ -z "${connexion_compte:-}" ]; then + connexion_compte=true + ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +fi + +# If separateur_csv doesn't exist, create it +if [ -z "${separateur_csv:-}" ]; then + separateur_csv=";" + ynh_app_setting_set --app=$app --key=separateur_csv --value=$separateur_csv +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From e094e74fb454efc8144e58e9c80226918106caf5 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:14:07 +0700 Subject: [PATCH 45/60] Test with other name --- conf/config.php | 4 ++-- config_panel.toml | 4 ++-- scripts/install | 8 ++++---- scripts/upgrade | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/conf/config.php b/conf/config.php index 1f8ea46..86a603a 100644 --- a/conf/config.php +++ b/conf/config.php @@ -20,8 +20,8 @@ define("SMTP_PORT", 25); define("SMTP_MAIL", "__APP__@__DOMAIN__"); define("SMTP_PASSWORD", ""); -define("CREATION_COMPTE", __CREATION_COMPTE__); -define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); +define("CREATION_COMPTE", __CRE_COMPTE__); +define("CONNEXION_COMPTE", __CON_COMPTE__); define("CSV_SEP", "__SEPARATEUR_CSV__"); diff --git a/config_panel.toml b/config_panel.toml index df8c071..312542b 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ name = "Moncycle.app configuration" yes = "true" no = "false" help = "Don't disable account creation before creating one for yourself !" - bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" + bind = "CREA_COMPTE:__INSTALL_DIR__/config.php" [main.comptes.connexion_compte] ask.en = "Enable account connexion" @@ -22,7 +22,7 @@ name = "Moncycle.app configuration" default = "true" yes = "true" no = "false" - bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" + bind = "CON_COMPTE:__INSTALL_DIR__/config.php" [main.export] name = "export" diff --git a/scripts/install b/scripts/install index 357c0ab..82c509c 100755 --- a/scripts/install +++ b/scripts/install @@ -9,12 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte=true -connexion_compte=true +cre_compte=true +con_compte=true separateur_csv=";" -ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte -ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +ynh_app_setting_set --app=$app --key=cre_compte --value=$cre_compte +ynh_app_setting_set --app=$app --key=con_compte --value=$con_compte ynh_app_setting_set --app=$app --key=separateur_csv --value=$separateur_csv #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 036ce37..193c2f8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,15 +16,15 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) # If creation_compte doesn't exist, create it -if [ -z "${creation_compte:-}" ]; then - creation_compte=true - ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +if [ -z "${cre_compte:-}" ]; then + cre_compte=true + ynh_app_setting_set --app=$app --key=cre_compte --value=$cre_compte fi # If connexion_compte doesn't exist, create it -if [ -z "${connexion_compte:-}" ]; then - connexion_compte=true - ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +if [ -z "${con_compte:-}" ]; then + con_compte=true + ynh_app_setting_set --app=$app --key=con_compte --value=$con_compte fi # If separateur_csv doesn't exist, create it From fefc5e3775377475b27b6be4b2488cd7caefde52 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:17:13 +0700 Subject: [PATCH 46/60] Update config_panel.toml --- config_panel.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 312542b..3ce6f8f 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -5,7 +5,7 @@ name = "Moncycle.app configuration" [main.comptes] name = "comptes" - [main.comptes.creation_compte] + [main.comptes.cre_compte] ask.en = "Enable account creation" ask.fr = "Permettre la création de nouveaux comptes" type = "boolean" @@ -15,7 +15,7 @@ name = "Moncycle.app configuration" help = "Don't disable account creation before creating one for yourself !" bind = "CREA_COMPTE:__INSTALL_DIR__/config.php" - [main.comptes.connexion_compte] + [main.comptes.con_compte] ask.en = "Enable account connexion" ask.fr = "Permettre la connexion aux comptes" type = "boolean" From 0b7b93320780e9dc65db2601fe6e4262d5c9aedf Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:25:17 +0700 Subject: [PATCH 47/60] Update config_panel.toml --- config_panel.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 3ce6f8f..de31e93 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ name = "Moncycle.app configuration" yes = "true" no = "false" help = "Don't disable account creation before creating one for yourself !" - bind = "CREA_COMPTE:__INSTALL_DIR__/config.php" + bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" [main.comptes.con_compte] ask.en = "Enable account connexion" @@ -22,7 +22,7 @@ name = "Moncycle.app configuration" default = "true" yes = "true" no = "false" - bind = "CON_COMPTE:__INSTALL_DIR__/config.php" + bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" [main.export] name = "export" @@ -32,4 +32,4 @@ name = "Moncycle.app configuration" ask.fr = "Séparateur pour l'export des données au format csv" type = "string" default = ";" - bind = "SEPARATEUR_CSV:__INSTALL_DIR__/config.php" \ No newline at end of file + bind = "CSV_SEP:__INSTALL_DIR__/config.php" \ No newline at end of file From 94045d1f95b00f7bfb19510b25919ce4a17670d8 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:43:03 +0700 Subject: [PATCH 48/60] Test --- config_panel.toml | 6 +++--- scripts/install | 8 -------- scripts/upgrade | 18 ------------------ 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index de31e93..e48c6ae 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -5,7 +5,7 @@ name = "Moncycle.app configuration" [main.comptes] name = "comptes" - [main.comptes.cre_compte] + [main.comptes.creation_compte] ask.en = "Enable account creation" ask.fr = "Permettre la création de nouveaux comptes" type = "boolean" @@ -15,7 +15,7 @@ name = "Moncycle.app configuration" help = "Don't disable account creation before creating one for yourself !" bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" - [main.comptes.con_compte] + [main.comptes.connexion_compte] ask.en = "Enable account connexion" ask.fr = "Permettre la connexion aux comptes" type = "boolean" @@ -27,7 +27,7 @@ name = "Moncycle.app configuration" [main.export] name = "export" - [main.export.separateur_csv] + [main.export.csv_sep] ask.en = "Separator for data export in csv format" ask.fr = "Séparateur pour l'export des données au format csv" type = "string" diff --git a/scripts/install b/scripts/install index 82c509c..7b55452 100755 --- a/scripts/install +++ b/scripts/install @@ -9,14 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -cre_compte=true -con_compte=true -separateur_csv=";" - -ynh_app_setting_set --app=$app --key=cre_compte --value=$cre_compte -ynh_app_setting_set --app=$app --key=con_compte --value=$con_compte -ynh_app_setting_set --app=$app --key=separateur_csv --value=$separateur_csv - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 193c2f8..c63e47b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,24 +15,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -# If creation_compte doesn't exist, create it -if [ -z "${cre_compte:-}" ]; then - cre_compte=true - ynh_app_setting_set --app=$app --key=cre_compte --value=$cre_compte -fi - -# If connexion_compte doesn't exist, create it -if [ -z "${con_compte:-}" ]; then - con_compte=true - ynh_app_setting_set --app=$app --key=con_compte --value=$con_compte -fi - -# If separateur_csv doesn't exist, create it -if [ -z "${separateur_csv:-}" ]; then - separateur_csv=";" - ynh_app_setting_set --app=$app --key=separateur_csv --value=$separateur_csv -fi - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From e60c6e93d3d7001501f798090e2064329d7f38e2 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:49:56 +0700 Subject: [PATCH 49/60] Update config.php --- conf/config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/config.php b/conf/config.php index 86a603a..fb6da8b 100644 --- a/conf/config.php +++ b/conf/config.php @@ -20,10 +20,10 @@ define("SMTP_PORT", 25); define("SMTP_MAIL", "__APP__@__DOMAIN__"); define("SMTP_PASSWORD", ""); -define("CREATION_COMPTE", __CRE_COMPTE__); -define("CONNEXION_COMPTE", __CON_COMPTE__); +define("CREATION_COMPTE", __CREATION_COMPTE__); +define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); -define("CSV_SEP", "__SEPARATEUR_CSV__"); +define("CSV_SEP", "__CSV_SEP__"); define("PHP_SECURE_COOKIES", true); From 433794840a1f245adf7950d31439014cea68321b Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 13:55:17 +0700 Subject: [PATCH 50/60] Update config panel --- scripts/config | 75 +++---------------------------------------------- scripts/install | 8 ++++++ scripts/upgrade | 19 +++++++++++++ 3 files changed, 31 insertions(+), 71 deletions(-) diff --git a/scripts/config b/scripts/config index b9e79f8..68aa9a8 100644 --- a/scripts/config +++ b/scripts/config @@ -24,77 +24,10 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get $app final_path) -#================================================= -# SPECIFIC GETTERS FOR TOML SHORT KEY -#================================================= - -get__amount() { - # Here we can imagine to have an API call to stripe to know the amount of donation during a month - local amount = 200 - - # It's possible to change some properties of the question by overriding it: - if [ $amount -gt 100 ] - then - cat << EOF -style: success -value: $amount -ask: - en: A lot of donation this month: **$amount €** -EOF - else - cat << EOF -style: danger -value: $amount -ask: - en: Not so much donation this month: $amount € -EOF - fi -} - -get__prices() { - local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" - if [ "$prices" == "," ]; - then - # Return YNH_NULL if you prefer to not return a value at all. - echo YNH_NULL - else - echo $prices - fi -} - - -#================================================= -# SPECIFIC VALIDATORS FOR TOML SHORT KEYS -#================================================= -validate__publishable_key() { - - # We can imagine here we test if the key is really a publisheable key - (is_secret_key $publishable_key) && - echo 'This key seems to be a secret key' -} - -#================================================= -# SPECIFIC SETTERS FOR TOML SHORT KEYS -#================================================= -set__prices() { - - #--------------------------------------------- - # IMPORTANT: setter are trigger only if a change is detected - #--------------------------------------------- - for price in $(echo $prices | sed "s/,/ /"); do - frequency=$(echo $price | cut -d/ -f1) - currency=$(echo $price | cut -d/ -f2) - price_id=$(echo $price | cut -d/ -f3) - sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py" - - echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py" - done - - #--------------------------------------------- - # IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too - #--------------------------------------------- - ynh_app_setting_set $app prices $prices -} +# import needed settings +creation_compte=$(ynh_app_setting_get --app="$app" --key=creation_compte) +connexion_compte=$(ynh_app_setting_get --app="$app" --key=connexion_compte) +csv_sep=$(ynh_app_setting_get --app="$app" --key=csv_sep) #================================================= # GENERIC FINALIZATION diff --git a/scripts/install b/scripts/install index 7b55452..bc74d3f 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,14 @@ source _common.sh source /usr/share/yunohost/helpers +creation_compte="true" +connexion_compte="true" +csv_sep=";" + +ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c63e47b..02c406b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,25 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) +# If creation_compte doesn't exist, create it +if [ -z "${creation_compte:-}" ]; then + creation_compte=true + ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +fi + +# If connexion_compte doesn't exist, create it +if [ -z "${connexion_compte:-}" ]; then + connexion_compte=true + ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +fi + +# If separateur_csv doesn't exist, create it +if [ -z "${csv_sep:-}" ]; then + csv_sep=";" + ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep +fi + + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From aecee9186c32ea816e6a5373ba29e29a6e0d40c7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 16:35:36 +0700 Subject: [PATCH 51/60] Test select instead of boolean --- config_panel.toml | 10 ++++------ scripts/upgrade | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index e48c6ae..3adba3d 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -8,20 +8,18 @@ name = "Moncycle.app configuration" [main.comptes.creation_compte] ask.en = "Enable account creation" ask.fr = "Permettre la création de nouveaux comptes" - type = "boolean" + type = "select" + choices = ["true", "false"] default = "true" - yes = "true" - no = "false" help = "Don't disable account creation before creating one for yourself !" bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" [main.comptes.connexion_compte] ask.en = "Enable account connexion" ask.fr = "Permettre la connexion aux comptes" - type = "boolean" + type = "select" + choices = ["true", "false"] default = "true" - yes = "true" - no = "false" bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" [main.export] diff --git a/scripts/upgrade b/scripts/upgrade index 02c406b..794b2ef 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,13 +17,13 @@ upgrade_type=$(ynh_check_app_version_changed) # If creation_compte doesn't exist, create it if [ -z "${creation_compte:-}" ]; then - creation_compte=true + creation_compte="true" ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte fi # If connexion_compte doesn't exist, create it if [ -z "${connexion_compte:-}" ]; then - connexion_compte=true + connexion_compte="true" ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte fi From 7b9a14e844aed0a4ccd5638617321a90ed87a85c Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 16:43:29 +0700 Subject: [PATCH 52/60] Test with only csv --- config_panel.toml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 3adba3d..ed0d95d 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -5,22 +5,22 @@ name = "Moncycle.app configuration" [main.comptes] name = "comptes" - [main.comptes.creation_compte] - ask.en = "Enable account creation" - ask.fr = "Permettre la création de nouveaux comptes" - type = "select" - choices = ["true", "false"] - default = "true" - help = "Don't disable account creation before creating one for yourself !" - bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" - - [main.comptes.connexion_compte] - ask.en = "Enable account connexion" - ask.fr = "Permettre la connexion aux comptes" - type = "select" - choices = ["true", "false"] - default = "true" - bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" + # [main.comptes.creation_compte] + # ask.en = "Enable account creation" + # ask.fr = "Permettre la création de nouveaux comptes" + # type = "select" + # choices = ["true", "false"] + # default = "true" + # help = "Don't disable account creation before creating one for yourself !" + # bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" + # + # [main.comptes.connexion_compte] + # ask.en = "Enable account connexion" + # ask.fr = "Permettre la connexion aux comptes" + # type = "select" + # choices = ["true", "false"] + # default = "true" + # bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" [main.export] name = "export" From 5b9eb422c219a1cb40cb78eb4f681222693f208b Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 16:49:52 +0700 Subject: [PATCH 53/60] Update config_panel.toml --- config_panel.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index ed0d95d..3700b75 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -2,8 +2,8 @@ version = "1.0" [main] name = "Moncycle.app configuration" - [main.comptes] - name = "comptes" + # [main.comptes] + # name = "comptes" # [main.comptes.creation_compte] # ask.en = "Enable account creation" From 950a96cd958f95e363c2b99e46f46e7254fdb144 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 17:08:03 +0700 Subject: [PATCH 54/60] Test --- config_panel.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 3700b75..b85be5a 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -28,6 +28,7 @@ name = "Moncycle.app configuration" [main.export.csv_sep] ask.en = "Separator for data export in csv format" ask.fr = "Séparateur pour l'export des données au format csv" + bind = "CSV_SEP:__INSTALL_DIR__/config.php" type = "string" - default = ";" - bind = "CSV_SEP:__INSTALL_DIR__/config.php" \ No newline at end of file + #default = ";" + \ No newline at end of file From 917d8705f143b349e319adeb7dfd07eef0a220de Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 17:09:55 +0700 Subject: [PATCH 55/60] Update config_panel.toml --- config_panel.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index b85be5a..f6c6c06 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -26,9 +26,9 @@ name = "Moncycle.app configuration" name = "export" [main.export.csv_sep] - ask.en = "Separator for data export in csv format" - ask.fr = "Séparateur pour l'export des données au format csv" - bind = "CSV_SEP:__INSTALL_DIR__/config.php" + #ask.en = "Separator for data export in csv format" + #ask.fr = "Séparateur pour l'export des données au format csv" + bind = ":__INSTALL_DIR__/config.php" type = "string" #default = ";" \ No newline at end of file From 1fe7a406c56a5ba34adf2e1fd33f0f297da592ab Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 17:29:17 +0700 Subject: [PATCH 56/60] Test --- conf/config.php | 2 +- scripts/config | 8 ++++---- scripts/install | 4 ++-- scripts/upgrade | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/conf/config.php b/conf/config.php index fb6da8b..6e4f591 100644 --- a/conf/config.php +++ b/conf/config.php @@ -23,7 +23,7 @@ define("SMTP_PASSWORD", ""); define("CREATION_COMPTE", __CREATION_COMPTE__); define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); -define("CSV_SEP", "__CSV_SEP__"); +define("CSV_SEP", ";"); define("PHP_SECURE_COOKIES", true); diff --git a/scripts/config b/scripts/config index 68aa9a8..d03f829 100644 --- a/scripts/config +++ b/scripts/config @@ -24,10 +24,10 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get $app final_path) -# import needed settings -creation_compte=$(ynh_app_setting_get --app="$app" --key=creation_compte) -connexion_compte=$(ynh_app_setting_get --app="$app" --key=connexion_compte) -csv_sep=$(ynh_app_setting_get --app="$app" --key=csv_sep) +## import needed settings +#creation_compte=$(ynh_app_setting_get --app="$app" --key=creation_compte) +#connexion_compte=$(ynh_app_setting_get --app="$app" --key=connexion_compte) +#csv_sep=$(ynh_app_setting_get --app="$app" --key=csv_sep) #================================================= # GENERIC FINALIZATION diff --git a/scripts/install b/scripts/install index bc74d3f..2a84339 100755 --- a/scripts/install +++ b/scripts/install @@ -11,11 +11,11 @@ source /usr/share/yunohost/helpers creation_compte="true" connexion_compte="true" -csv_sep=";" +#csv_sep=";" ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte -ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep +#ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index 794b2ef..883dd58 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,10 +28,10 @@ if [ -z "${connexion_compte:-}" ]; then fi # If separateur_csv doesn't exist, create it -if [ -z "${csv_sep:-}" ]; then - csv_sep=";" - ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep -fi +#if [ -z "${csv_sep:-}" ]; then +# csv_sep=";" +# ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep +#fi #================================================= From c721eb6a5e3873dd5b1b9db62d5b5a9ff6d8c6a1 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 12:27:12 +0700 Subject: [PATCH 57/60] Test config panel Test config panel Update config_panel.toml Update install Update install Update install Update install Test Update install Test Test with other name Update config_panel.toml Update config_panel.toml Test Update config.php Update config panel Test select instead of boolean Test with only csv Update config_panel.toml Test Update config_panel.toml --- conf/config.php | 4 +-- config_panel.toml | 34 ++++++++++++++++++ config_panel.toml.example | 10 ------ scripts/config | 75 +++------------------------------------ scripts/install | 8 +++++ scripts/upgrade | 19 ++++++++++ 6 files changed, 67 insertions(+), 83 deletions(-) create mode 100644 config_panel.toml delete mode 100644 config_panel.toml.example diff --git a/conf/config.php b/conf/config.php index f4ced39..6e4f591 100644 --- a/conf/config.php +++ b/conf/config.php @@ -20,8 +20,8 @@ define("SMTP_PORT", 25); define("SMTP_MAIL", "__APP__@__DOMAIN__"); define("SMTP_PASSWORD", ""); -define("CREATION_COMPTE", true); -define("CONNEXION_COMPTE", true); +define("CREATION_COMPTE", __CREATION_COMPTE__); +define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); define("CSV_SEP", ";"); diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..f6c6c06 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,34 @@ +version = "1.0" +[main] +name = "Moncycle.app configuration" + + # [main.comptes] + # name = "comptes" + + # [main.comptes.creation_compte] + # ask.en = "Enable account creation" + # ask.fr = "Permettre la création de nouveaux comptes" + # type = "select" + # choices = ["true", "false"] + # default = "true" + # help = "Don't disable account creation before creating one for yourself !" + # bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" + # + # [main.comptes.connexion_compte] + # ask.en = "Enable account connexion" + # ask.fr = "Permettre la connexion aux comptes" + # type = "select" + # choices = ["true", "false"] + # default = "true" + # bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" + + [main.export] + name = "export" + + [main.export.csv_sep] + #ask.en = "Separator for data export in csv format" + #ask.fr = "Séparateur pour l'export des données au format csv" + bind = ":__INSTALL_DIR__/config.php" + type = "string" + #default = ";" + \ No newline at end of file diff --git a/config_panel.toml.example b/config_panel.toml.example deleted file mode 100644 index 49dae20..0000000 --- a/config_panel.toml.example +++ /dev/null @@ -1,10 +0,0 @@ -version = "1.0" -[main] -name = "Moncycle.app configuration" - [main.comptes] - name = "comptes" - [main.comptes.CREATION_COMPTE] - ask.en = "Enable account creation" - type = "boolean" - default = "true" - bind = ":__INSTALL_DIR__/config.php" \ No newline at end of file diff --git a/scripts/config b/scripts/config index b9e79f8..d03f829 100644 --- a/scripts/config +++ b/scripts/config @@ -24,77 +24,10 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get $app final_path) -#================================================= -# SPECIFIC GETTERS FOR TOML SHORT KEY -#================================================= - -get__amount() { - # Here we can imagine to have an API call to stripe to know the amount of donation during a month - local amount = 200 - - # It's possible to change some properties of the question by overriding it: - if [ $amount -gt 100 ] - then - cat << EOF -style: success -value: $amount -ask: - en: A lot of donation this month: **$amount €** -EOF - else - cat << EOF -style: danger -value: $amount -ask: - en: Not so much donation this month: $amount € -EOF - fi -} - -get__prices() { - local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" - if [ "$prices" == "," ]; - then - # Return YNH_NULL if you prefer to not return a value at all. - echo YNH_NULL - else - echo $prices - fi -} - - -#================================================= -# SPECIFIC VALIDATORS FOR TOML SHORT KEYS -#================================================= -validate__publishable_key() { - - # We can imagine here we test if the key is really a publisheable key - (is_secret_key $publishable_key) && - echo 'This key seems to be a secret key' -} - -#================================================= -# SPECIFIC SETTERS FOR TOML SHORT KEYS -#================================================= -set__prices() { - - #--------------------------------------------- - # IMPORTANT: setter are trigger only if a change is detected - #--------------------------------------------- - for price in $(echo $prices | sed "s/,/ /"); do - frequency=$(echo $price | cut -d/ -f1) - currency=$(echo $price | cut -d/ -f2) - price_id=$(echo $price | cut -d/ -f3) - sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py" - - echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py" - done - - #--------------------------------------------- - # IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too - #--------------------------------------------- - ynh_app_setting_set $app prices $prices -} +## import needed settings +#creation_compte=$(ynh_app_setting_get --app="$app" --key=creation_compte) +#connexion_compte=$(ynh_app_setting_get --app="$app" --key=connexion_compte) +#csv_sep=$(ynh_app_setting_get --app="$app" --key=csv_sep) #================================================= # GENERIC FINALIZATION diff --git a/scripts/install b/scripts/install index 7b55452..2a84339 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,14 @@ source _common.sh source /usr/share/yunohost/helpers +creation_compte="true" +connexion_compte="true" +#csv_sep=";" + +ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +#ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c63e47b..883dd58 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,25 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) +# If creation_compte doesn't exist, create it +if [ -z "${creation_compte:-}" ]; then + creation_compte="true" + ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte +fi + +# If connexion_compte doesn't exist, create it +if [ -z "${connexion_compte:-}" ]; then + connexion_compte="true" + ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte +fi + +# If separateur_csv doesn't exist, create it +#if [ -z "${csv_sep:-}" ]; then +# csv_sep=";" +# ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep +#fi + + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From ccce75e2e3a94837828202c1c59f99cbfebcd407 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 17:45:52 +0700 Subject: [PATCH 58/60] Revert "Test config panel" This reverts commit c721eb6a5e3873dd5b1b9db62d5b5a9ff6d8c6a1. --- conf/config.php | 4 +-- config_panel.toml | 34 ------------------ config_panel.toml.example | 10 ++++++ scripts/config | 75 ++++++++++++++++++++++++++++++++++++--- scripts/install | 8 ----- scripts/upgrade | 19 ---------- 6 files changed, 83 insertions(+), 67 deletions(-) delete mode 100644 config_panel.toml create mode 100644 config_panel.toml.example diff --git a/conf/config.php b/conf/config.php index 6e4f591..f4ced39 100644 --- a/conf/config.php +++ b/conf/config.php @@ -20,8 +20,8 @@ define("SMTP_PORT", 25); define("SMTP_MAIL", "__APP__@__DOMAIN__"); define("SMTP_PASSWORD", ""); -define("CREATION_COMPTE", __CREATION_COMPTE__); -define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); +define("CREATION_COMPTE", true); +define("CONNEXION_COMPTE", true); define("CSV_SEP", ";"); diff --git a/config_panel.toml b/config_panel.toml deleted file mode 100644 index f6c6c06..0000000 --- a/config_panel.toml +++ /dev/null @@ -1,34 +0,0 @@ -version = "1.0" -[main] -name = "Moncycle.app configuration" - - # [main.comptes] - # name = "comptes" - - # [main.comptes.creation_compte] - # ask.en = "Enable account creation" - # ask.fr = "Permettre la création de nouveaux comptes" - # type = "select" - # choices = ["true", "false"] - # default = "true" - # help = "Don't disable account creation before creating one for yourself !" - # bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" - # - # [main.comptes.connexion_compte] - # ask.en = "Enable account connexion" - # ask.fr = "Permettre la connexion aux comptes" - # type = "select" - # choices = ["true", "false"] - # default = "true" - # bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" - - [main.export] - name = "export" - - [main.export.csv_sep] - #ask.en = "Separator for data export in csv format" - #ask.fr = "Séparateur pour l'export des données au format csv" - bind = ":__INSTALL_DIR__/config.php" - type = "string" - #default = ";" - \ No newline at end of file diff --git a/config_panel.toml.example b/config_panel.toml.example new file mode 100644 index 0000000..49dae20 --- /dev/null +++ b/config_panel.toml.example @@ -0,0 +1,10 @@ +version = "1.0" +[main] +name = "Moncycle.app configuration" + [main.comptes] + name = "comptes" + [main.comptes.CREATION_COMPTE] + ask.en = "Enable account creation" + type = "boolean" + default = "true" + bind = ":__INSTALL_DIR__/config.php" \ No newline at end of file diff --git a/scripts/config b/scripts/config index d03f829..b9e79f8 100644 --- a/scripts/config +++ b/scripts/config @@ -24,10 +24,77 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get $app final_path) -## import needed settings -#creation_compte=$(ynh_app_setting_get --app="$app" --key=creation_compte) -#connexion_compte=$(ynh_app_setting_get --app="$app" --key=connexion_compte) -#csv_sep=$(ynh_app_setting_get --app="$app" --key=csv_sep) +#================================================= +# SPECIFIC GETTERS FOR TOML SHORT KEY +#================================================= + +get__amount() { + # Here we can imagine to have an API call to stripe to know the amount of donation during a month + local amount = 200 + + # It's possible to change some properties of the question by overriding it: + if [ $amount -gt 100 ] + then + cat << EOF +style: success +value: $amount +ask: + en: A lot of donation this month: **$amount €** +EOF + else + cat << EOF +style: danger +value: $amount +ask: + en: Not so much donation this month: $amount € +EOF + fi +} + +get__prices() { + local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" + if [ "$prices" == "," ]; + then + # Return YNH_NULL if you prefer to not return a value at all. + echo YNH_NULL + else + echo $prices + fi +} + + +#================================================= +# SPECIFIC VALIDATORS FOR TOML SHORT KEYS +#================================================= +validate__publishable_key() { + + # We can imagine here we test if the key is really a publisheable key + (is_secret_key $publishable_key) && + echo 'This key seems to be a secret key' +} + +#================================================= +# SPECIFIC SETTERS FOR TOML SHORT KEYS +#================================================= +set__prices() { + + #--------------------------------------------- + # IMPORTANT: setter are trigger only if a change is detected + #--------------------------------------------- + for price in $(echo $prices | sed "s/,/ /"); do + frequency=$(echo $price | cut -d/ -f1) + currency=$(echo $price | cut -d/ -f2) + price_id=$(echo $price | cut -d/ -f3) + sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py" + + echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py" + done + + #--------------------------------------------- + # IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too + #--------------------------------------------- + ynh_app_setting_set $app prices $prices +} #================================================= # GENERIC FINALIZATION diff --git a/scripts/install b/scripts/install index 2a84339..7b55452 100755 --- a/scripts/install +++ b/scripts/install @@ -9,14 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte="true" -connexion_compte="true" -#csv_sep=";" - -ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte -ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte -#ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 883dd58..c63e47b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,25 +15,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -# If creation_compte doesn't exist, create it -if [ -z "${creation_compte:-}" ]; then - creation_compte="true" - ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte -fi - -# If connexion_compte doesn't exist, create it -if [ -z "${connexion_compte:-}" ]; then - connexion_compte="true" - ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte -fi - -# If separateur_csv doesn't exist, create it -#if [ -z "${csv_sep:-}" ]; then -# csv_sep=";" -# ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep -#fi - - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From e6d4cb9942a96a36f2608258c9c6447df57755c4 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 17:49:06 +0700 Subject: [PATCH 59/60] Final update v10 yunohost --- conf/version.json | 4 ++-- doc/POST_INSTALL.md | 2 +- manifest.toml | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/conf/version.json b/conf/version.json index 38a35cc..83ce69b 100644 --- a/conf/version.json +++ b/conf/version.json @@ -1,6 +1,6 @@ { "app": "moncycle.app", "version": "10.0~ynh1", - "build": "2024-02-20", - "commit": "31f2dd5" + "build": "2024-02-21", + "commit": "6e19865" } diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index f268c09..9f0e131 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,4 +1,4 @@ * After installing, you can create your own user using the form -* Once done, you can (if you want) set the account creation to false in the config panel +* Once done, you can (if you want) set the account creation to false in `/var/www/moncycle/config.php` * If you want to use the app in PWA mode, be sure to be connected to your account first * After upgrading from 7.0 to 9.0, you may experience issues if you don't clean your browser cache diff --git a/manifest.toml b/manifest.toml index 4bfda05..b01bc00 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,8 +34,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/31f2dd5272d617de30ee58e79052b3af7ae5b5d4.zip" - sha256 = "7f8fd2f7b28c16a308a67f476b34f2797b10a8f6285c36aa71b6876b845baf80" + url = "https://github.com/jean-io/moncycle.app/archive/6e198655d54370f782f9c74a7361724a87090f13.zip" + sha256 = "9bc1ee0890ee649c0ee16f56de2165778f398be450201be9329c25675ca457e8" [resources.system_user] @@ -49,6 +49,3 @@ ram.runtime = "50M" [resources.database] type = "mysql" - - [main.main.CREATION_COMPTE] - CREATION_COMPTE="true" From 66ec7c384407c4f32e8d5531387e4b0a26cbaa73 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 17:54:12 +0700 Subject: [PATCH 60/60] Updates --- conf/config.php | 4 +-- ...ig_panel.toml => config_panel.toml.example | 0 scripts/install | 8 ------ scripts/upgrade | 25 ------------------- 4 files changed, 2 insertions(+), 35 deletions(-) rename config_panel.toml => config_panel.toml.example (100%) diff --git a/conf/config.php b/conf/config.php index 6e4f591..f4ced39 100644 --- a/conf/config.php +++ b/conf/config.php @@ -20,8 +20,8 @@ define("SMTP_PORT", 25); define("SMTP_MAIL", "__APP__@__DOMAIN__"); define("SMTP_PASSWORD", ""); -define("CREATION_COMPTE", __CREATION_COMPTE__); -define("CONNEXION_COMPTE", __CONNEXION_COMPTE__); +define("CREATION_COMPTE", true); +define("CONNEXION_COMPTE", true); define("CSV_SEP", ";"); diff --git a/config_panel.toml b/config_panel.toml.example similarity index 100% rename from config_panel.toml rename to config_panel.toml.example diff --git a/scripts/install b/scripts/install index 2a84339..7b55452 100755 --- a/scripts/install +++ b/scripts/install @@ -9,14 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -creation_compte="true" -connexion_compte="true" -#csv_sep=";" - -ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte -ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte -#ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 883dd58..3d3f0de 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,31 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -# If creation_compte doesn't exist, create it -if [ -z "${creation_compte:-}" ]; then - creation_compte="true" - ynh_app_setting_set --app=$app --key=creation_compte --value=$creation_compte -fi - -# If connexion_compte doesn't exist, create it -if [ -z "${connexion_compte:-}" ]; then - connexion_compte="true" - ynh_app_setting_set --app=$app --key=connexion_compte --value=$connexion_compte -fi - -# If separateur_csv doesn't exist, create it -#if [ -z "${csv_sep:-}" ]; then -# csv_sep=";" -# ynh_app_setting_set --app=$app --key=csv_sep --value=$csv_sep -#fi - - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================