diff --git a/README.md b/README.md index 457950f..85ea94c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ TODO : [ ] remove new locale on remove -[ ] Why the flag don't show?? +[X] Why the flag don't show?? [X] Implement Admin panel diff --git a/conf/nginx.conf b/conf/nginx.conf index 8a587a5..1333f44 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location YNH_EXAMPLE_PATH { # Path to source alias YNH_EXAMPLE_ALIAS ; # Example PHP configuration - index index.php; + index www/index.php; try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; diff --git a/manifest.json b/manifest.json index 89a6e62..eb310aa 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Créez des adresses email jetables qui redirigent les mails vers votre adresse réelle" }, "url": "https://framagit.org/kepon/emailPoubellePhp/", - "version": "2.0~ynh2", + "version": "2.0~ynh3", "license": "Beerware", "maintainer": { "name": "krakinou", diff --git a/scripts/install b/scripts/install index 5b7189a..72d2acd 100644 --- a/scripts/install +++ b/scripts/install @@ -74,6 +74,7 @@ ynh_replace_string "Template-exemple" "$domain" $final_path/www/index.php #Temporaire - mettre en config ln -s $final_path/lang/fr $final_path/lang/fr_FR ln -s $final_path/lang/it $final_path/lang/it_IT +ln -s $final_path/www/template-exemple $final_path/template-exemple #=============================================== @@ -121,7 +122,7 @@ sudo newaliases # Modify Nginx configuration file and copy it to Nginx conf directory sudo sed -i "s@YNH_EXAMPLE_PATH@$path_url@g" ../conf/nginx.conf -sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path/www/@g" ../conf/nginx.conf +sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path/@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Handle root path, avoid double slash. diff --git a/scripts/upgrade b/scripts/upgrade index 95f70d1..8685b38 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,9 +60,16 @@ if [[ $?==0 ]]; then ynh_replace_string "define('ALIASLIMITBYMAIL" "//define('ALIASLIMITBYMAIL" $final_path/conf.php #setting conf file not world-readable (dude, there is a plain-text password !) sudo chmod o-r $final_path/conf.php - + fi +#change nginx.conf as per https://forum.yunohost.org/t/need-help-on-nginx-conf-cannot-access-resources/6342 +ynh_replace_string "alias $finalpath/www/ ;" "alias $finalpath/ ;" /etc/yunohost/$domain.d/$app.conf +ynh_replace_string "index index.php;" "index www/ndex.php;" /etc/yunohost/$domain.d/$app.conf + +#correct template name in index.php +ynh_replace_string "Template-exemple" "$domain" $final_path/www/index.php + #mysqlpwd setting was implemented in ynh2 - check if saved and if not implement db_pass=$(ynh_app_setting_get $app mysqlpwd) if [ -z $db_pass]; then @@ -83,11 +90,15 @@ cp ../src/README.md $final_path/README.md cp ../src/CHANGELOG.md $final_path/CHANGELOG.md cp ../src/conf-dist.php $final_path/conf-dist.php cp ../conf/index_source.php $final_path/www/index.php - +test -e $final_path/template-exemple +if [[ ! $? -eq 0 ]]; then + ln -s $final_path/www/template-exemple $final_path/template-exemple +fi #Temporaire - mettre en config ln -s $final_path/lang/fr $final_path/lang/fr_FR ln -s $final_path/lang/it $final_path/lang/it_IT + chown -R www-data:www-data $final_path #adding php-cli for cron diff --git a/src/lib/ep_function.php b/src/lib/ep_function.php index cd21177..b608101 100644 --- a/src/lib/ep_function.php +++ b/src/lib/ep_function.php @@ -79,7 +79,13 @@ function AjouterAlias($status, $alias,$email, $life, $comment) { die(); } UpdateVirtualDB(); - return $dbco->lastInsertId(); + if (preg_match('/^sqlite/', DB)) { + return $dbco->lastInsertId(); + } else { + $stmt = $dbco->query("SELECT LAST_INSERT_ID()"); + return $stmt->fetchColumn(); + } + } // delete email