fabrice.regnier
6 months ago
36 changed files with 23 additions and 796 deletions
@ -1,166 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
KAZ_ROOT=$(cd "$(dirname $0)"/..; pwd) |
|||
KAZ_ROOT=/kaz |
|||
. $KAZ_ROOT/bin/.commonFunctions.sh |
|||
setKazVars |
|||
|
|||
. $DOCKERS_ENV |
|||
. $KAZ_ROOT/secret/SetAllPass.sh |
|||
|
|||
URL_GARRADIN="$httpProto://${garradin_API_USER}:${garradin_API_PASSWORD}@kaz-garradin.$(echo $domain)" |
|||
|
|||
PRG=$(basename $0) |
|||
RACINE=$(echo $PRG | awk '{print $1}') |
|||
|
|||
TFILE_INT_GARRAGIN_ACTION=$(mktemp /tmp/XXXXXXXX_INT_GARRAGIN_ACTION.json) |
|||
TFILE_INT_GARRAGIN_IDFILE=$(mktemp /tmp/XXXXXXXX_TFILE_INT_GARRAGIN_IDFILE.json) |
|||
FILE_CREATEUSER="$KAZ_ROOT/tmp/createUser.txt" |
|||
|
|||
sep=' ' |
|||
|
|||
#trap "rm -f ${TFILE_INT_GARRAGIN_IDFILE} ${TFILE_INT_GARRAGIN_ACTION} " 0 1 2 3 15 |
|||
|
|||
############################################ Fonctions ####################################################### |
|||
TEXTE=" |
|||
# -- fichier de création des comptes KAZ |
|||
# -- |
|||
# -- 1 ligne par compte |
|||
# -- champs séparés par ;. les espaces en début et en fin sont enlevés |
|||
# -- laisser vide si pas de donnée |
|||
# -- pas d'espace dans les variables |
|||
# -- |
|||
# -- ORGA: nom de l'organisation (max 15 car), vide sinon |
|||
# -- ADMIN_ORGA: O/N indique si le user est admin de l'orga (va le créer comme admin du NC de l'orga et admin de l'équipe agora) |
|||
# -- NC_ORGA: O/N indique si l'orga a demandé un NC |
|||
# -- GARRADIN_ORGA: O/N indique si l'orga a demandé un garradin |
|||
# -- WP_ORGA: O/N indique si l'orga a demandé un wp |
|||
# -- AGORA_ORGA: O/N indique si l'orga a demandé un mattermost |
|||
# -- WIKI_ORGA: O/N indique si l'orga a demandé un wiki |
|||
# -- NC_BASE: O/N indique si le user doit être inscrit dans le NC de base |
|||
# -- GROUPE_NC_BASE: soit null soit le groupe dans le NC de base |
|||
# -- EQUIPE_AGORA: soit null soit equipe agora (max 15 car) |
|||
# -- QUOTA=(1/10/20/...) en GB |
|||
# -- |
|||
# NOM ; PRENOM ; EMAIL_SOUHAITE ; EMAIL_SECOURS ; ORGA ; ADMIN_ORGA ; NC_ORGA ; GARRADIN_ORGA ; WP_ORGA ; AGORA_ORGA ; WIKI_ORGA ; NC_BASE ; GROUPE_NC_BASE ; EQUIPE_AGORA ; QUOTA |
|||
# |
|||
# exemple pour un compte découverte: |
|||
# dupont ; jean-louis; jean-louis.dupont@kaz.bzh ; gregomondo@kaz.bzh; ; N; N; N; N; N; N; O; ; ;1 |
|||
# |
|||
# exemple pour un compte asso de l'orga gogol avec le service dédié NC uniquement + une équipe dans l'agora |
|||
# dupont ; jean-louis; jean-louis.dupont@kaz.bzh ; gregomondo@kaz.bzh; gogol ; O; O; N; N; N; N;N;;gogol_team; 10 |
|||
" |
|||
|
|||
Int_Garradin_Action() { |
|||
# $1 est une action; |
|||
ACTION=$1 |
|||
OPTION=$2 |
|||
# on envoie la requête sur le serveur garradin avec la clause à créer |
|||
# problème de gestion de remontée de données dans la table services_users quand le compte a plus de 2 activités |
|||
#curl -s ${URL_GARRADIN}/api/sql -d "SELECT * from membres cross join services_users on membres.id = services_users.id_user where membres.action_auto='${ACTION}';" >>${TFILE_INT_GARRAGIN_ACTION} |
|||
curl -s ${URL_GARRADIN}/api/sql -d "SELECT * from membres where action_auto='${ACTION}';" >>${TFILE_INT_GARRAGIN_ACTION} |
|||
[ ! -z ${TFILE_INT_GARRAGIN_ACTION} ] || { echo "probleme de fichier ${TFILE_INT_GARRAGIN_ACTION}" ; exit 1;} |
|||
REP_ID=$(jq -c '.results[].id ' ${TFILE_INT_GARRAGIN_ACTION} 2>/dev/null) |
|||
if [ ! -z "${REP_ID}" ] |
|||
then |
|||
[ "$OPTION" = "silence" ] || echo -e "${RED}Nombre de compte ${ACTION} ${NC}= ${GREEN} $(echo ${REP_ID} | wc -w) ${NC}" |
|||
if [ -f "$FILE_CREATEUSER" ] |
|||
then |
|||
mv $FILE_CREATEUSER $FILE_CREATEUSER.$(date +%d-%m-%Y-%H:%M:%S) |
|||
fi |
|||
echo "# -------- Fichier généré le $(date +%d-%m-%Y-%H:%M:%S) ----------">${FILE_CREATEUSER} |
|||
echo "${TEXTE}" >>${FILE_CREATEUSER} |
|||
for VAL_ID in ${REP_ID} |
|||
do |
|||
jq -c --argjson val "${VAL_ID}" '.results[] | select (.id == $val)' ${TFILE_INT_GARRAGIN_ACTION} > ${TFILE_INT_GARRAGIN_IDFILE} |
|||
for VAL_GAR in id_category action_auto nom email email_secours quota_disque admin_orga nom_orga responsable_organisation responsable_email agora cloud wordpress garradin docuwiki id_service |
|||
do |
|||
eval $VAL_GAR=$(jq .$VAL_GAR ${TFILE_INT_GARRAGIN_IDFILE}) |
|||
done |
|||
#comme tout va bien on continue |
|||
#on compte le nom de champs dans la zone nom pour gérer les noms et prénoms composés |
|||
# si il y a 3 champs, on associe les 2 premieres valeurs avec un - et on laisse le 3ème identique |
|||
# si il y a 4 champs on associe les 1 et le 2 avec un tiret et le 3 et 4 avec un tiret |
|||
# on met les champs nom_ok et prenom_ok à blanc |
|||
nom_ok="" |
|||
prenom_ok="" |
|||
# on regarde si le nom de l' orga est renseigné ou si le nom de l' orga est null et l' activité de membre est 7 (membre rattaché) |
|||
# si c' est le cas alors le nom est le nom de l' orga et le prénom est forcé à la valeur Organisation |
|||
if [[ "$nom_orga" = null ]] || [[ "$nom_orga" != null && "$id_service" = "7" ]] |
|||
then |
|||
[ "$OPTION" = "silence" ] || echo -e "${NC}Abonné ${GREEN}${nom}${NC}" |
|||
#si lactivité est membre rattaché on affiche a quelle orga il est rattaché |
|||
if [ "$id_service" = "7" ] && [ "$OPTION" != "silence" ] && [ "$nom_orga" != null ] |
|||
then |
|||
echo -e "${NC}Orga Rattachée : ${GREEN}${nom_orga}${NC}" |
|||
fi |
|||
COMPTE_NOM=$(echo $nom | awk -F' ' '{for (i=1; i != NF; i++); print i;}') |
|||
case "${COMPTE_NOM}" in |
|||
0|1) |
|||
echo "Il faut corriger le champ nom (il manque un nom ou prénom) de garradin" |
|||
echo "je quitte et supprime le fichier ${FILE_CREATEUSER}" |
|||
rm -f $FILE_CREATEUSER |
|||
exit 2 |
|||
;; |
|||
2) |
|||
nom_ok=$(echo $nom | awk -F' ' '{print $1}') |
|||
prenom_ok=$(echo $nom | awk -F' ' '{print $2}') |
|||
;; |
|||
*) |
|||
nom_ok= |
|||
prenom_ok= |
|||
for i in ${nom}; do grep -q '^[A-Z]*$' <<<"${i}" && nom_ok="${nom_ok}${sep}${i}" || prenom_ok="${prenom_ok}${sep}${i}"; done |
|||
nom_ok="${nom_ok#${sep}}" |
|||
prenom_ok="${prenom_ok#${sep}}" |
|||
if [ -z "${nom_ok}" ] || [ -z "${prenom_ok}" ]; then |
|||
echo "Il faut corriger le champ nom (peut être un nom de famille avec une particule ?) de garradin" |
|||
echo "je quitte et supprime le fichier ${FILE_CREATEUSER}" |
|||
rm -f $FILE_CREATEUSER |
|||
exit |
|||
fi |
|||
esac |
|||
# comme l' orga est à null nom orga est a vide, pas d' admin orga, on met dans l' agora générale |
|||
# pas d' équipe agora et de groupe nextcloud spécifique |
|||
|
|||
nom_orga=" " |
|||
admin_orga="N" |
|||
nc_base="O" |
|||
equipe_agora=" " |
|||
groupe_nc_base=" " |
|||
else |
|||
# L' orga est renseigné dans garradin donc les nom et prenoms sont forcé a nom_orga et Organisation |
|||
# un équipe agora portera le nom de l' orga, le compte ne sera pas créé dans le nextcloud général |
|||
# et le compte est admin de son orga |
|||
nom_orga=$(echo $nom_orga | tr [:upper:] [:lower:]) |
|||
[ "$OPTION" = "silence" ] || echo -e "${NC}Orga : ${GREEN}${nom_orga}${NC}" |
|||
nom_ok=$nom_orga |
|||
# test des caractères autorisés dans le nom d' orga: lettres, chiffres et/ou le tiret |
|||
if ! [[ "${nom_ok}" =~ ^[[:alnum:]-]+$ ]]; then |
|||
echo "Erreur : l' orga doit être avec des lettres et/ou des chiffres. Le séparateur doit être le tiret" |
|||
rm -f $FILE_CREATEUSER� |
|||
exit 2 |
|||
fi |
|||
prenom_ok=organisation |
|||
equipe_agora=$nom_orga |
|||
groupe_nc_base=" " |
|||
nc_base="N" |
|||
admin_orga="O" |
|||
fi |
|||
# Pour le reste on renomme les null en N ( non ) et les valeurs 1 en O ( Oui) |
|||
cloud=$(echo $cloud | sed -e 's/null/N/g' | sed -e 's/1/O/g') |
|||
garradin=$(echo $garradin | sed -e 's/null/N/g' | sed -e 's/1/O/g') |
|||
wordpress=$(echo $wordpress | sed -e 's/null/N/g' | sed -e 's/1/O/g') |
|||
agora=$(echo $agora | sed -e 's/null/N/g' | sed -e 's/1/O/g') |
|||
docuwiki=$(echo $docuwiki | sed -e 's/null/N/g' | sed -e 's/1/O/g') |
|||
# et enfin on écrit dans le fichier |
|||
echo "$nom_ok;$prenom_ok;$email;$email_secours;$nom_orga;$admin_orga;$cloud;$garradin;$wordpress;$agora;$docuwiki;$nc_base;$groupe_nc_base;$equipe_agora;$quota_disque">>${FILE_CREATEUSER} |
|||
done |
|||
else |
|||
echo "Rien à créer" |
|||
exit 2 |
|||
fi |
|||
} |
|||
#Int_Garradin_Action "A créer" "silence" |
|||
Int_Garradin_Action "A créer" |
|||
exit 0 |
|||
|
@ -1 +0,0 @@ |
|||
../../config/dockers.env |
@ -1,86 +0,0 @@ |
|||
FROM php:8.2-apache |
|||
#FROM php:8.1-apache |
|||
|
|||
# pour upgrader garradin, il suffit de modifier le numéro de version ici |
|||
ENV GARRADIN_VERSION 1.2.11 |
|||
|
|||
ENV GARRADIN_DOWNLOAD_DIR download/garradin |
|||
ENV GARRADIN_DIR /usr/share/garradin |
|||
|
|||
######################################## |
|||
# 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/deb.debian.org/${APT_MIRROR_DEBIAN}/g" \ |
|||
-e "s/security.debian.org/${APT_MIRROR_DEBIAN_SECURITY}/g" \ |
|||
-e "s/archive.ubuntu.com/${APT_MIRROR_UBUNTU}/g" \ |
|||
-e "s/security.ubuntu.com/${APT_MIRROR_UBUNTU_SECURITY}/g" \ |
|||
/etc/apt/sources.list; fi |
|||
|
|||
######################################## |
|||
RUN apt-get update --quiet && apt-get install -y \ |
|||
libicu-dev libpq-dev zlib1g-dev libicu-dev \ |
|||
libzip-dev git wget zip patch |
|||
|
|||
#install composer setup script |
|||
COPY dockers/garradin/composer-setup.sh /usr/local/bin/ |
|||
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 ctype |
|||
RUN /usr/local/bin/composer-setup.sh |
|||
|
|||
ADD "${GARRADIN_DOWNLOAD_DIR}/paheko-${GARRADIN_VERSION}.tar.gz" /usr/share/ |
|||
RUN mv /usr/share/paheko-${GARRADIN_VERSION} ${GARRADIN_DIR} |
|||
|
|||
RUN echo '<IfModule mod_negotiation.c>\n\ |
|||
Options -MultiViews\n\ |
|||
</IfModule>\n\ |
|||
\n\ |
|||
php_value upload_max_filesize 100M\n\ |
|||
php_value post_max_size 100M\n\ |
|||
php_value memory_limit 256M\n\ |
|||
FallbackResource /_route.php\n\ |
|||
'> ${GARRADIN_DIR}/www/.htaccess |
|||
|
|||
#install prince pour génération pdf |
|||
RUN curl https://www.princexml.com/download/prince_20230609-1_debian12_amd64.deb --output prince.deb |
|||
RUN apt-get install libdeflate0 libjbig0 libjpeg62-turbo -y |
|||
|
|||
#on récupère 3 paquets de sécu sur bullseyes (me demande pas pourquoi) |
|||
RUN curl http://security.debian.org/debian-security/pool/updates/main/libw/libwebp/libwebp6_0.6.1-2.1+deb11u1_amd64.deb --output libwebp6_0.6.1.deb |
|||
RUN curl http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1n-0+deb11u5_amd64.deb --output libssl1.1_1.1.deb |
|||
RUN curl http://http.us.debian.org/debian/pool/main/t/tiff/libtiff5_4.2.0-1+deb11u4_amd64.deb --output libtiff5_4.2.0.deb |
|||
RUN dpkg -i libwebp6_0.6.1.deb |
|||
RUN dpkg -i libssl1.1_1.1.deb |
|||
RUN dpkg -i libtiff5_4.2.0.deb |
|||
RUN apt-get install libfontconfig1 libgif7 libjpeg62-turbo liblcms2-2 libtiff5-dev -y |
|||
RUN apt-get install libaom3 libavif15 -y |
|||
RUN dpkg -i prince.deb |
|||
|
|||
COPY dockers/garradin/config/factory_cron.sh ${GARRADIN_DIR}/ |
|||
COPY dockers/garradin/config/factory_cron_emails.sh ${GARRADIN_DIR}/ |
|||
COPY dockers/garradin/config/setupWebRights.sh ${GARRADIN_DIR}/ |
|||
RUN mkdir ${GARRADIN_DIR}/users |
|||
|
|||
#install cron pour factory_cron.sh |
|||
RUN apt-get install cron joe rsyslog -y |
|||
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf |
|||
RUN echo "0 1 * * * cd ${GARRADIN_DIR} && ${GARRADIN_DIR}/factory_cron.sh" >> /var/spool/cron/crontabs/root |
|||
RUN echo "* * * * * cd ${GARRADIN_DIR} && ${GARRADIN_DIR}/factory_cron_emails.sh" >> /var/spool/cron/crontabs/root |
|||
RUN chmod 600 /var/spool/cron/crontabs/root |
|||
RUN sed -i "/exec/i\service cron start\n" /usr/local/bin/docker-php-entrypoint |
|||
RUN ln -sf /usr/local/bin/php /usr/bin/ |
|||
|
|||
# Set owner web server |
|||
RUN chown -R www-data: ${GARRADIN_DIR} |
|||
|
|||
#fab le 03/02/2023: pour avoir un php.ini de prod avec zend.assertions = -1 |
|||
RUN cp "/usr/local/etc/php/php.ini-production" "/usr/local/etc/php/php.ini" |
|||
|
|||
EXPOSE 80 |
|||
VOLUME [ "/usr/share/garradin/users" ] |
@ -1,48 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
KAZ_ROOT=$(cd "$(dirname $0)/../.."; pwd) |
|||
. "${KAZ_ROOT}/bin/.commonFunctions.sh" |
|||
setKazVars |
|||
|
|||
###########################################################################" |
|||
#on récupère la dernière version de garradin et tous les plugin |
|||
|
|||
GAR_VER=$(grep "^ENV GARRADIN_VERSION" Dockerfile | awk '{print $3}') |
|||
FCT_VER="0.7.4" |
|||
echo "VERSION GARRADIN : $GAR_VER" |
|||
echo "VERSION FACTURATION : $FCT_VER" |
|||
|
|||
downloadFile () { |
|||
# $1 URL to download |
|||
if [ ! -f "$(basename "$1")" ]; then |
|||
printKazMsg " - load $1" |
|||
curl -L -O "$1" |
|||
fi |
|||
} |
|||
|
|||
mkdir -p "${KAZ_DNLD_DIR}/garradin" |
|||
cd "${KAZ_DNLD_DIR}/garradin" |
|||
|
|||
#pour être certain de récupérer les dernières versions de plugin |
|||
rm * -f |
|||
|
|||
printKazMsg "\n *** Download garradin on ${KAZ_DNLD_DIR}" |
|||
|
|||
downloadFile "https://fossil.kd2.org/garradin/uv/paheko-${GAR_VER}.tar.gz" |
|||
|
|||
downloadFile "https://fossil.kd2.org/garradin-plugins/uv/caisse.tar.gz" |
|||
#downloadFile "https://fossil.kd2.org/garradin-plugins/uv/dompdf.tar.gz" |
|||
#downloadFile "https://fossil.kd2.org/garradin-plugins/uv/helloasso.tar.gz" |
|||
downloadFile "https://fossil.kd2.org/garradin-plugins/uv/ouvertures.tar.gz" |
|||
downloadFile "https://fossil.kd2.org/garradin-plugins/uv/reservations.tar.gz" |
|||
downloadFile "https://fossil.kd2.org/garradin-plugins/uv/stock_velos.tar.gz" |
|||
downloadFile "https://fossil.kd2.org/garradin-plugins/uv/taima.tar.gz" |
|||
downloadFile "https://gitlab.com/JBthePenguin/garradin-plugin-materiels/-/raw/main/materiels.tar.gz" |
|||
downloadFile "https://noizette.net/archive/garradin-plugin-facturation/${FCT_VER}/facturation.tar.gz" |
|||
|
|||
########################################################################### |
|||
printKazMsg "\n *** Création du Dockerfile garradin" |
|||
|
|||
cd "${KAZ_ROOT}" |
|||
|
|||
docker build -t garkaz . -f dockers/garradin/Dockerfile |
@ -1,18 +0,0 @@ |
|||
#!/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 |
|||
|
@ -1,127 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace Garradin; |
|||
|
|||
/** |
|||
* Ce fichier permet de configurer Garradin pour une utilisation |
|||
* avec plusieurs associations, mais une seule copie du code source. |
|||
* (aussi appel?? installation multi-sites, ferme ou usine) |
|||
* |
|||
* Voir la doc : https://fossil.kd2.org/garradin/wiki?name=Multi-sites |
|||
* |
|||
* N'oubliez pas d'installer ??galement le script cron.sh fournit |
|||
* pour lancer les rappels automatiques et sauvegardes. |
|||
* |
|||
* Si cela ne suffit pas ?? vos besoins, contactez-nous : https://garradin.eu/contact |
|||
* pour une aide sp??cifique ?? votre installation. |
|||
*/ |
|||
|
|||
// Nom de domaine parent des associations h??berg??es |
|||
// Exemple : si vos associations sont h??berg??es en clubdetennis.garradin.eu, |
|||
// indiquer ici 'garradin.eu' |
|||
const FACTORY_DOMAIN = "__DOMAIN__"; |
|||
|
|||
// R??pertoire o?? seront stock??es les donn??es des utilisateurs |
|||
// Dans ce r??pertoire, un sous-r??pertoire sera cr???? pour chaque compte |
|||
// Ainsi 'clubdetennis.garradin.eu' sera dans le r??pertoire courant (__DIR__), |
|||
// sous-r??pertoire 'users' et dans celui-ci, sous-r??pertoire 'clubdetennis' |
|||
// |
|||
// Pour chaque utilisateur il faudra cr??er le sous-r??pertoire en premier lieu |
|||
// (eg. mkdir .../users/clubdetennis) |
|||
const FACTORY_USER_DIRECTORY = __DIR__ . '/users'; |
|||
|
|||
// Envoyer les erreurs PHP par mail ?? l'adresse de l'administrateur syst??me |
|||
// (mettre ?? null pour ne pas recevoir d'erreurs) |
|||
const MAIL_ERRORS = 'garradin@kaz.bzh'; |
|||
|
|||
// IMPORTANT ! |
|||
// Modifier pour indiquer une valeur al??atoire de plus de 30 caract??res |
|||
const SECRET_KEY = 'HkXFwmMIMaI1T4X9/BIxKahxa74tQvAj0z1keal/jXj7i2w1ifzvalPSAshAbSg2P/fhmh9TlA3+gD28jg+ljA=='; |
|||
|
|||
// Quota de stockage de documents (en octets) |
|||
// D??finit la taille de stockage disponible pour chaque association pour ses documents |
|||
const FILE_STORAGE_QUOTA = 10 * 1024 * 1024 * 1024; // 10 Go |
|||
|
|||
//////////////////////////////////////////////////////////////// |
|||
// R??glages conseill??s, normalement il n'y a rien ?? modifier ici |
|||
|
|||
// Indiquer que l'on va utiliser cron pour lancer les t??ches ?? ex??cuter (envoi de rappels de cotisation) |
|||
const USE_CRON = true; |
|||
|
|||
// Cache partag?? |
|||
const SHARED_CACHE_ROOT = __DIR__ . '/cache'; |
|||
|
|||
// D??sactiver le log des erreurs PHP visible dans l'interface (s??curit??) |
|||
const ENABLE_TECH_DETAILS = false; |
|||
|
|||
// D??sactiver les mises ?? jour depuis l'interface web |
|||
// Pour ??tre s??r que seul l'admin sys puisse faire des mises ?? jour |
|||
const ENABLE_UPGRADES = false; |
|||
|
|||
//////////////////////////////////////////////////////////////// |
|||
// Code 'magique' qui va configurer Garradin selon les r??glages |
|||
|
|||
$login = null; |
|||
|
|||
// Un sous-domaine ne peut pas faire plus de 63 caract??res |
|||
$login_regexp = '([a-z0-9_-]{1,63})'; |
|||
$domain_regexp = sprintf('/^%s\.%s$/', $login_regexp, preg_quote(FACTORY_DOMAIN, '/')); |
|||
|
|||
|
|||
//original |
|||
//if (isset($_SERVER['SERVER_NAME']) && preg_match($regexp, $_SERVER['SERVER_NAME'], $match)) { |
|||
//maj kaz |
|||
if (isset($_SERVER['SERVER_NAME']) && preg_match('/^([a-z0-9_\-]+)-garradin\.__DOMAIN__$/', $_SERVER['SERVER_NAME'], $match)) { |
|||
$login = $match[1]; |
|||
} |
|||
elseif (PHP_SAPI == 'cli' && !empty($_SERVER['GARRADIN_FACTORY_USER']) && preg_match('/^' . $login_regexp . '$/', $_SERVER['GARRADIN_FACTORY_USER'])) { |
|||
$login = $_SERVER['GARRADIN_FACTORY_USER']; |
|||
} |
|||
else { |
|||
// Login invalide ou non fourni |
|||
http_response_code(404); |
|||
die('<h1>Page non trouv??e</h1>'); |
|||
} |
|||
|
|||
$user_data_dir = rtrim(FACTORY_USER_DIRECTORY, '/') . '/' . $login; |
|||
|
|||
|
|||
if (!is_dir($user_data_dir)) { |
|||
mkdir($user_data_dir, 0700, true); |
|||
//http_response_code(404); |
|||
//die("<h1>Cette association n'existe pas.</h1>"); |
|||
} |
|||
|
|||
// D??finir le dossier o?? sont stock??s les donn??es |
|||
define('Garradin\DATA_ROOT', $user_data_dir); |
|||
|
|||
const PREFER_HTTPS = false; |
|||
const SMTP_HOST = "__SMTP_HOST__.__DOMAIN__"; |
|||
const SMTP_USER = null; |
|||
const API_USER = "__GARRADIN_API_USER__"; |
|||
const API_PASSWORD = "__GARRADIN_API_PASSWORD__"; |
|||
const SMTP_PASSWORD = null; |
|||
const SMTP_PORT = 25; |
|||
const SMTP_SECURITY = 'NONE'; |
|||
const ROOT = __DIR__; |
|||
|
|||
const DB_FILE = DATA_ROOT . '/association.sqlite'; |
|||
const PLUGINS_ROOT = DATA_ROOT . '/plugins'; |
|||
|
|||
// D??finir l'URL |
|||
//original |
|||
//define('Garradin\WWW_URL', 'https://' . $login . FACTORY_USER_DIRECTORY . '/'); |
|||
//maj kaz |
|||
define('Garradin\WWW_URL', "__HTTP_PROTO__://".$login."-garradin.__DOMAIN__/"); |
|||
|
|||
define('Garradin\WWW_URI', '/'); |
|||
|
|||
// Désactiver le log des erreurs visible dans l'interface (sécurité) |
|||
define('Garradin\ERRORS_ENABLE_LOG_VIEW', true); |
|||
|
|||
// Ne pas afficher les erreurs de code |
|||
define('Garradin\SHOW_ERRORS', true); |
|||
|
|||
|
|||
#add by fab le 21/04/2022 |
|||
const PDF_COMMAND = 'prince'; |
@ -1,17 +0,0 @@ |
|||
#!/bin/sh |
|||
|
|||
# Répertoire où sont stockées les données des utilisateurs |
|||
# veiller à ce que ce soit le même que dans config.local.php |
|||
FACTORY_USER_DIRECTORY="users" |
|||
|
|||
# Chemin vers le script cron.php de Garradin |
|||
GARRADIN_CRON_SCRIPT="scripts/cron.php" |
|||
|
|||
cd /usr/share/garradin |
|||
|
|||
for user in $(cd ${FACTORY_USER_DIRECTORY} && ls -1d */) |
|||
do |
|||
GARRADIN_FACTORY_USER=$(basename "$user") /usr/bin/php $GARRADIN_CRON_SCRIPT |
|||
echo $GARRADIN_FACTORY_USER |
|||
done |
|||
|
@ -1,14 +0,0 @@ |
|||
#!/bin/sh |
|||
|
|||
# Répertoire où sont stockées les données des utilisateurs |
|||
# veiller à ce que ce soit le même que dans config.local.php |
|||
FACTORY_USER_DIRECTORY="users" |
|||
|
|||
# Chemin vers le script emails.php de Garradin |
|||
GARRADIN_CRON_SCRIPT="scripts/emails.php" |
|||
|
|||
for user in $(cd ${FACTORY_USER_DIRECTORY} && ls -1d */) |
|||
do |
|||
GARRADIN_FACTORY_USER=$(basename "$user") /usr/bin/php $GARRADIN_CRON_SCRIPT |
|||
echo $GARRADIN_FACTORY_USER |
|||
done |
@ -1,26 +0,0 @@ |
|||
<VirtualHost *:80> |
|||
#ServerName garradin.kaz.bzh |
|||
DocumentRoot /usr/share/garradin/www |
|||
ErrorLog /var/log/apache2/error.log |
|||
CustomLog /var/log/apache2/access.log combined |
|||
ServerSignature Off |
|||
|
|||
<Directory /usr/share/garradin/www > |
|||
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> |
|||
|
|||
FallbackResource /_route.php |
|||
|
|||
|
|||
</VirtualHost> |
@ -1,3 +0,0 @@ |
|||
#!/bin/sh |
|||
|
|||
chown -R www-data: /usr/share/garradin |
@ -1,38 +0,0 @@ |
|||
version: '3.5' |
|||
|
|||
services: |
|||
|
|||
garradin: |
|||
image: garkaz |
|||
build: . |
|||
container_name: ${garradinServName} |
|||
volumes: |
|||
- ./config/garradin.conf:/etc/apache2/sites-available/000-default.conf |
|||
- ./config/config.local.php:/usr/share/garradin/config.local.php |
|||
- ./config/factory_cron.sh:/usr/share/garradin/factory_cron.sh |
|||
# - ./config/cron.php:/usr/share/garradin/scripts/cron.php |
|||
- assoUsers:/usr/share/garradin/users |
|||
- /etc/localtime:/etc/localtime:ro |
|||
- /etc/timezone:/etc/timezone:ro |
|||
# ports: |
|||
# - 8086:80 |
|||
networks: |
|||
- garradinNet |
|||
- postfixNet |
|||
external_links: |
|||
- ${smtpServName}:${smtpHost}.${domain} |
|||
labels: |
|||
- "traefik.enable=true" |
|||
- "traefik.frontend.rule=HostRegexp:{host:[a-zA-Z0-9_-]+-${garHost}}.${domain}" |
|||
- "traefik.http.routers.${garradinServName}.rule=HostRegexp(`{host:[a-zA-Z0-9_-]+-${garHost}}.${domain}`)" |
|||
|
|||
volumes: |
|||
assoUsers: |
|||
|
|||
networks: |
|||
garradinNet: |
|||
external: true |
|||
name: garradinNet |
|||
postfixNet: |
|||
external: true |
|||
name: postfixNet |
@ -1,19 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
SERV_DIR=$(cd $(dirname $0); pwd) |
|||
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd) |
|||
. "${KAZ_ROOT}/bin/.commonFunctions.sh" |
|||
setKazVars |
|||
|
|||
cd $(dirname $0) |
|||
. "${DOCKERS_ENV}" |
|||
|
|||
|
|||
if ! [[ "$(docker ps -f name=${garradinServName} | grep -w ${garradinServName})" ]]; then |
|||
echo -e "Garradin not running... abort" |
|||
exit |
|||
fi |
|||
|
|||
printKazMsg "\n *** Premier lancement de Garradin" |
|||
|
|||
docker exec "${garradinServName}" /usr/share/garradin/setupWebRights.sh |
@ -1,12 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
KAZ_ROOT=$(cd "$(dirname $0)/../.."; pwd) |
|||
. "${KAZ_ROOT}/bin/.commonFunctions.sh" |
|||
setKazVars |
|||
|
|||
TMPL=config/config.local.tmpl.php |
|||
CONF=config/config.local.php |
|||
|
|||
cd $(dirname $0) |
|||
|
|||
"${APPLY_TMPL}" "${TMPL}" "${CONF}" |
@ -1,17 +0,0 @@ |
|||
Index: src/include/lib/Garradin/Template.php |
|||
================================================================== |
|||
--- /usr/share/garradin/include/lib/Garradin/Template.php |
|||
+++ /usr/share/garradin/include/lib/Garradin/Template.php |
|||
@@ -482,11 +482,11 @@ |
|||
|
|||
$input = sprintf('<span id="%s_container" class="input-list">%s%s</span>', $this->escape($attributes['id']), $button, $values); |
|||
} |
|||
elseif ($type == 'money') { |
|||
if (null !== $current_value && !$current_value_from_user) { |
|||
- $current_value = Utils::money_format($current_value, ',', ''); |
|||
+ $current_value = Utils::money_format($current_value, ',', '', false); |
|||
} |
|||
|
|||
if ((string) $current_value === '0') { |
|||
$current_value = ''; |
|||
} |
@ -1,58 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
PRG="$0" |
|||
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd) |
|||
. "${KAZ_ROOT}/bin/.commonFunctions.sh" |
|||
setKazVars |
|||
|
|||
if [ ! -d "${DOCK_VOL_GAR_ORGA}" ]; then |
|||
printKazError "\nno garradin volume!" |
|||
exit |
|||
fi |
|||
|
|||
GAR_PLG_LIST=$(getGarradinPluginList) |
|||
GAR_ORGA_LIST=$(getGarradinOrgaList) |
|||
|
|||
usage(){ |
|||
echo "Usage: ${PRG} [orga...]" |
|||
# XXX set of extention ? |
|||
echo " -h help" |
|||
exit 1 |
|||
} |
|||
|
|||
ORGA_SET= |
|||
for ORGA in $@ |
|||
do |
|||
case "${ORGA}" in |
|||
'-h' | '-help' ) |
|||
usage |
|||
;; |
|||
* ) |
|||
if [[ ! "${NL}${GAR_ORGA_LIST}${NL}" =~ "${NL}${ORGA}${NL}" ]]; then |
|||
printKazError "\n ${PRG}: ${ORGA} not in ${GAR_ORGA_LIST}" |
|||
else |
|||
ORGA_SET="${ORGA_SET} ${ORGA}" |
|||
fi |
|||
;; |
|||
esac |
|||
done |
|||
|
|||
if [ -z "${ORGA_SET}" ] ; then |
|||
ORGA_SET=${GAR_ORGA_LIST} |
|||
fi |
|||
|
|||
for ORGA in ${ORGA_SET}; do |
|||
if [ ! -d "${DOCK_VOL_GAR_ORGA}/${ORGA}/" ]; then |
|||
continue |
|||
fi |
|||
echo -ne "\n *** ${ORGA} plugins :" |
|||
for PLG in ${GAR_PLG_LIST}; do |
|||
echo -n " ${PLG}" |
|||
cd "${DOCK_VOL_GAR_ORGA}/${ORGA}/plugins/" |
|||
PLG_NAME="${PLG%%.*}" |
|||
mkdir -p "${PLG_NAME}" |
|||
cd "${PLG_NAME}" |
|||
tar -xzf "${KAZ_DNLD_GAR_DIR}/${PLG}" |
|||
done |
|||
echo |
|||
done |
@ -1,4 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
echo -e "\n *** Reload Garradin" |
|||
docker exec -ti garradinServ apachectl -k restart |
@ -1,58 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
PRG="$0" |
|||
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd) |
|||
. "${KAZ_ROOT}/bin/.commonFunctions.sh" |
|||
setKazVars |
|||
|
|||
if [ ! -d "${DOCK_VOL_PAHEKO_ORGA}" ]; then |
|||
printKazError "\nno paheko volume!" |
|||
exit |
|||
fi |
|||
|
|||
PAHEKO_PLG_LIST=$(getPahekoPluginList) |
|||
PAHEKO_ORGA_LIST=$(getPahekoOrgaList) |
|||
|
|||
usage(){ |
|||
echo "Usage: ${PRG} [orga...]" |
|||
# XXX set of extention ? |
|||
echo " -h help" |
|||
exit 1 |
|||
} |
|||
|
|||
ORGA_SET= |
|||
for ORGA in $@ |
|||
do |
|||
case "${ORGA}" in |
|||
'-h' | '-help' ) |
|||
usage |
|||
;; |
|||
* ) |
|||
if [[ ! "${NL}${PAHEKO_ORGA_LIST}${NL}" =~ "${NL}${ORGA}${NL}" ]]; then |
|||
printKazError "\n ${PRG}: ${ORGA} not in ${PAHEKO_ORGA_LIST}" |
|||
else |
|||
ORGA_SET="${ORGA_SET} ${ORGA}" |
|||
fi |
|||
;; |
|||
esac |
|||
done |
|||
|
|||
if [ -z "${ORGA_SET}" ] ; then |
|||
ORGA_SET=${PAHEKO_ORGA_LIST} |
|||
fi |
|||
|
|||
for ORGA in ${ORGA_SET}; do |
|||
if [ ! -d "${DOCK_VOL_PAHEKO_ORGA}/${ORGA}/" ]; then |
|||
continue |
|||
fi |
|||
echo -ne "\n *** ${ORGA} plugins :" |
|||
for PLG in ${PAHEKO_PLG_LIST}; do |
|||
echo -n " ${PLG}" |
|||
cd "${DOCK_VOL_PAHEKO_ORGA}/${ORGA}/plugins/" |
|||
PLG_NAME="${PLG%%.*}" |
|||
mkdir -p "${PLG_NAME}" |
|||
cd "${PLG_NAME}" |
|||
tar -xzf "${KAZ_DNLD_PAHEKO_DIR}/${PLG}" |
|||
done |
|||
echo |
|||
done |
Loading…
Reference in new issue