first commit

This commit is contained in:
2024-06-03 18:43:35 +02:00
parent 2da01a3f6e
commit f501d519af
883 changed files with 71550 additions and 2 deletions

1
dockers/framadate/.env Symbolic link
View File

@ -0,0 +1 @@
../../config/dockers.env

View File

@ -0,0 +1,67 @@
FROM php:7.4-apache
########################################
# APT local cache
# work around because COPY failed if no source file
COPY .dummy .apt-mirror-confi[g] .proxy-confi[g] /
RUN cp /.proxy-config /etc/profile.d/proxy.sh 2> /dev/null || true
RUN if [ -f /.apt-mirror-config ] ; then . /.apt-mirror-config && sed -i \
-e "s%s\?://deb.debian.org%://${APT_MIRROR_DEBIAN}%g" \
-e "s%s\?://security.debian.org%://${APT_MIRROR_DEBIAN_SECURITY}%g" \
-e "s%s\?://archive.ubuntu.com%://${APT_MIRROR_UBUNTU}%g" \
-e "s%s\?://security.ubuntu.com%://${APT_MIRROR_UBUNTU_SECURITY}%g" \
/etc/apt/sources.list; fi
########################################
RUN apt-get update --quiet && apt-get install -y \
git wget zip patch \
libicu-dev libpq-dev zlib1g-dev libicu-dev
RUN apt-get install -y locales locales-all
RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:fr
RUN update-locale LANG=fr_FR.UTF-8
# install framadate
RUN mkdir /var/framadate
WORKDIR /var/framadate
COPY --chown=www-data git/framadate/ .
RUN cp php.ini /usr/local/etc/php/
# patch bad-e-mail
COPY dockers/framadate/patch/*.patch ./
RUN patch adminstuds.php adminstuds.php.patch
RUN patch create_classic_poll.php create_classic_poll.php.patch
RUN patch create_date_poll.php create_date_poll.php.patch
RUN patch find_polls.php find_polls.php.patch
RUN patch locale/en.json en.json.patch
RUN patch locale/fr.json fr.json.patch
# install composer setup script
COPY dockers/framadate/composer-setup.sh /usr/local/bin/
COPY dockers/framadate/kazdate.png /var/framadate/images/logo-framadate.png
COPY dockers/framadate/kazclassic.png /var/framadate/images/classic.png
COPY dockers/framadate/kazdates.png /var/framadate/images/date.png
RUN chmod +x /usr/local/bin/composer-setup.sh
# install internationalization libs
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
RUN docker-php-ext-install -j$(nproc) pdo pdo_mysql
RUN /usr/local/bin/composer-setup.sh
RUN php composer.phar install
# patch : Kaz don't use TLS
RUN sed -e 's%$tls = true;%//XXX Kaz not use TLS // $tls = true;%' -i vendor/phpmailer/phpmailer/src/PHPMailer.php
RUN chown -R www-data.www-data /var/framadate/
RUN a2enmod rewrite
RUN cp htaccess.txt .htaccess
RUN mkdir /svg
VOLUME ["/var/framadate/app/inc", "/etc/apache2/sites-available/000-default"]
EXPOSE 80

9
dockers/framadate/build.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
setKazVars
printKazMsg "\n *** Création du Dockerfile Framadate"
cd "${KAZ_ROOT}"
docker build -t datekaz . -f dockers/framadate/Dockerfile

View File

@ -0,0 +1,18 @@
#!/bin/sh
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT

View File

@ -0,0 +1,31 @@
<VirtualHost *:80>
ServerName date.kaz.bzh
DocumentRoot /var/framadate/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature Off
<Location /admin/ >
AuthType Basic
AuthName "Administration"
AuthUserFile "/var/framadate/admin/.htpasswd"
Require valid-user
</Location>
<Directory /var/framadate/ >
AllowOverride All
Require all granted
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
<FilesMatch "^\.ht.*">
deny from all
satisfy all
ErrorDocument 403 "Access denied."
</FilesMatch>
</VirtualHost>

View File

@ -0,0 +1,58 @@
version: '3.3'
services:
framadate:
# ports:
# - 8088:80
image: datekaz
container_name: ${framadateServName}
restart: ${restartPolicy}
depends_on:
- db
networks:
- framadateNet
- postfixNet
external_links:
- ${framadateDBName}:db
- ${smtpServName}:${smtpHost}
volumes:
- ./config/framadate.conf:/etc/apache2/sites-available/000-default.conf
- dateAdmin:/var/framadate/admin
- dateConfig:/var/framadate/app/inc
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.${framadateServName}-admin.rule=Host(`${dateHost}.${domain}`) && PathPrefix(`/admin`)"
- "traefik.http.routers.${framadateServName}-admin.middlewares=test-adminipwhitelist@file"
- "traefik.http.routers.${framadateServName}.rule=Host(`${dateHost}.${domain}`)"
- "traefik.docker.network=framadateNet"
db:
image: mariadb:10.5
container_name: ${framadateDBName}
restart: ${restartPolicy}
networks:
- framadateNet
env_file:
- ../../secret/env-${framadateDBName}
volumes:
- dateDB:/var/lib/mysql
- /home/sauve/:/svg/
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
volumes:
dateDB:
dateConfig:
dateAdmin:
dateLocale:
networks:
framadateNet:
external: true
name: framadateNet
postfixNet:
external: true
name: postfixNet

24
dockers/framadate/download.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
SERV_DIR=$(cd $(dirname $0); pwd)
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
setKazVars
SRC_FRAMADATE="https://github.com/framasoft/framadate.git"
FRAMDATE_VER="1.1.19"
printKazMsg "\n *** Download framadate"
mkdir -p "${KAZ_GIT_DIR}"
cd "${KAZ_GIT_DIR}"
if [ ! -d "framadate" ]; then
git clone "${SRC_FRAMADATE}" --branch ${FRAMDATE_VER}
fi
cd "${KAZ_GIT_DIR}/framadate"
if [ -z "$(git branch | grep "${FRAMDATE_VER}")" ]; then
printKazMsg " checkout branch ${FRAMDATE_VER}"
git reset --hard
git checkout ${FRAMADATE_VER}
fi

44
dockers/framadate/first.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
setKazVars
cd $(dirname $0)
. "${DOCKERS_ENV}"
. "${KAZ_KEY_DIR}/env-${framadateServName}"
. "${KAZ_KEY_DIR}/env-${framadateDBName}"
FRAMADATE_URL="${httpProto}://${dateHost}.${domain}"
checkDockerRunning "${framadateServName}" "Framadate" || exit
if [ ! -f "${DOCK_LIB}/volumes/framadate_dateConfig/_data/config.php" ]; then
printKazMsg "\n *** Premier lancement de Framadate"
waitUrl "${FRAMADATE_URL}"
${SIMU} docker exec "${framadateServName}" bash -c -i "htpasswd -bc /var/framadate/admin/.htpasswd ${HTTPD_USER} ${HTTPD_PASSWORD}"
${SIMU} docker exec "${framadateServName}" bash -c -i "chown www-data: /var/framadate/.htaccess /var/framadate/admin/.htpasswd"
curl -X POST \
-u "${HTTPD_USER}:${HTTPD_PASSWORD}" \
-d "appMail=framadate@kaz.bzh" \
-d "responseMail=no-reply@kaz.bzh" \
-d "defaultLanguage=fr" \
-d "cleanUrl=on" \
-d "dbConnectionString=mysql:host=db;dbname=${MYSQL_DATABASE};port=3306" \
-d "dbUser=${MYSQL_USER}" \
-d "dbPassword=${MYSQL_PASSWORD}" \
-d "dbPrefix=fd_" \
-d "migrationTable=framadate_migration" \
"${FRAMADATE_URL}/admin/install.php"
curl -X POST \
-u "${HTTPD_USER}:${HTTPD_PASSWORD}" \
"${FRAMADATE_URL}/admin/migration.php"
sed -e "s/'host'\s*=>\s*'[^']*',/'host' => 'smtp',/" \
-e "s/const\s*NOMAPPLICATION\s*=\s*'[^']*';/const NOMAPPLICATION = 'Sondage';/" \
-i "${DOCK_LIB}/volumes/framadate_dateConfig/_data/config.php"
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -0,0 +1,15 @@
--- adminstuds.php 2022-02-05 09:09:45.256310389 +0100
+++ adminstuds.php-new 2022-02-05 08:49:40.952269857 +0100
@@ -84,6 +84,12 @@
$message = new Message('success', __('adminstuds', 'The poll is created.'));
}
+$messageBadEmail = $sessionService->get("Framadate", "messageBadEmail", FALSE);
+if ($messageBadEmail) {
+ $sessionService->remove("Framadate", "messageBadEmail");
+ $message = new Message('danger', __('adminstuds', "Bad e-mail. Can't send links"));
+}
+
// -------------------------------
// Update poll info
// -------------------------------

View File

@ -0,0 +1,17 @@
--- create_classic_poll.php 2022-02-05 09:09:45.256310389 +0100
+++ create_classic_poll.php-new 2022-02-05 09:03:08.924297050 +0100
@@ -83,8 +83,12 @@
$message_admin .= sprintf(' :<br/><br/><a href="%1$s">%1$s</a>', Utils::getUrlSondage($admin_poll_id, true));
if ($mailService->isValidEmail($form->admin_mail)) {
- $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Author\'s message') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message_admin);
- $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'For sending to the polled users') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message);
+ try {
+ $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Author\'s message') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message_admin);
+ $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'For sending to the polled users') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message);
+ } catch (Exception $e) {
+ $sessionService->set("Framadate", "messageBadEmail", TRUE);
+ }
}
}

View File

@ -0,0 +1,17 @@
--- create_date_poll.php 2022-02-05 09:09:45.256310389 +0100
+++ create_date_poll.php-new 2022-02-05 08:47:40.708265810 +0100
@@ -210,8 +210,12 @@
$message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true));
if ($mailService->isValidEmail($form->admin_mail)) {
- $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Author\'s message') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message_admin);
- $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'For sending to the polled users') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message);
+ try {
+ $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Author\'s message') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message_admin);
+ $mailService->send($form->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'For sending to the polled users') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($form->title), $message);
+ } catch (Exception $e) {
+ $sessionService->set("Framadate", "messageBadEmail", TRUE);
+ }
}
}

View File

@ -0,0 +1,10 @@
--- locale/en.json 2022-02-05 09:09:45.256310389 +0100
+++ locale/en.json-new 2022-02-05 08:52:37.688275805 +0100
@@ -439,6 +439,7 @@
"Remove the comments": "Remove the comments",
"Remove the votes": "Remove the votes",
"The poll is created.": "The poll was created.",
+ "Bad e-mail. Can't send links": "Bad e-mail. Can't send links",
"Vote added": "Vote added",
"Vote deleted": "Vote deleted",
"Vote updated": "Vote updated",

View File

@ -0,0 +1,17 @@
--- find_polls.php 2022-02-05 09:09:45.256310389 +0100
+++ find_polls.php-new 2022-02-05 09:07:28.072305772 +0100
@@ -43,8 +43,12 @@
$smarty->assign('polls', $polls);
$body = $smarty->fetch('mail/find_polls.tpl');
- $mailService->send($mail, __('FindPolls', 'List of your polls') . ' - ' . NOMAPPLICATION, $body, 'SEND_POLLS');
- $message = new Message('success', __('FindPolls', 'Polls sent'));
+ try {
+ $mailService->send($mail, __('FindPolls', 'List of your polls') . ' - ' . NOMAPPLICATION, $body, 'SEND_POLLS');
+ $message = new Message('success', __('FindPolls', 'Polls sent'));
+ } catch (Exception $e) {
+ $message = new Message('warning', __('Error', 'No polls found'));
+ }
} else {
$message = new Message('warning', __('Error', 'No polls found'));
}

View File

@ -0,0 +1,10 @@
--- locale/fr.json 2022-02-05 09:09:45.256310389 +0100
+++ locale/fr.json-new 2022-02-05 08:57:14.468285120 +0100
@@ -435,6 +435,7 @@
"Remove the comments": "Supprimer les commentaires",
"Remove the votes": "Supprimer les votes",
"The poll is created.": "Le sondage a été créé.",
+ "Bad e-mail. Can't send links": "Mauvais mèl. Les liens n'ont pu être envoyés.",
"Vote added": "Vote ajouté",
"Vote deleted": "Vote supprimé",
"Vote updated": "Vote mis à jour",