TLS
|
@ -13,16 +13,13 @@
|
|||
- dns:
|
||||
- [dns-external](dns-external/README.md): DNS client with resolution on all zones (especially outside)
|
||||
- [dns-local](dns-local/README.md): DNS client with access to local zones
|
||||
- [dotclear](dotclear/README.md): Dotclear an open-source web publishing software
|
||||
- [dovecot](dovecot/README.md): Postfix and Dovecot as mail servers (Submission and IMAP)
|
||||
- [forgejo](forgejo/README.md): Forgejo, a community managed lightweight code hosting solution
|
||||
- [galette](galette/README.md): Galette, a membership management web application towards non profit organizations
|
||||
- [gitea](gitea/README.md): Transitional package for Gitea to Forgejo
|
||||
- [host-systemd-machined](host-systemd-machined/README.md): Host with machine started in Systemd Machined environment
|
||||
- [imap-client](imap-client/README.md): Application service needs interact with an IMAP server
|
||||
- [ldap-client](ldap-client/README.md): Application service needs interact with a LDAP server
|
||||
- [lemonldap](lemonldap/README.md): LemonLDAP, a Web Single Sign On and Access Management
|
||||
- [letsencrypt](letsencrypt/README.md): Let's encrypt, a nonprofit Certificate Authority providing TLS certificates
|
||||
- [mailman](mailman/README.md): GNU Mailman, managing electronic mail discussion and e-newsletter lists
|
||||
- mariadb:
|
||||
- [mariadb](mariadb/README.md): MariaDB, a relational database
|
||||
|
@ -42,6 +39,7 @@
|
|||
- [php](php/README.md): PHP, a popular general-purpose scripting language
|
||||
- [php-fpm](php-fpm/README.md): PHP FPM
|
||||
- [piwigo](piwigo/README.md): Piwigo, a photo management software
|
||||
- [pki-tls](pki-tls/README.md): Autosign PKI or Let's encrypt support for TLS certificates
|
||||
- postfix:
|
||||
- [postfix-lmtp-relay](postfix-lmtp-relay/README.md): Postfix, the mail server, as LMTP relay
|
||||
- [postfix-relay](postfix-relay/README.md): Postfix, the mail server, as relay
|
||||
|
@ -57,7 +55,6 @@
|
|||
- [relay-mail-client](relay-mail-client/README.md): Client SMTP
|
||||
- [reverse-proxy-client](reverse-proxy-client/README.md): Application service needs interact with a a reverse proxy server
|
||||
- [roundcube](roundcube/README.md): Roundcube, a webmail
|
||||
- [sensmotdire](sensmotdire/README.md): Sens Mot Dire, a french conjugaison service
|
||||
- [speedtest-rs](speedtest-rs/README.md): Speedtest-rs, a very lightweight Speedtest
|
||||
- [systemd](systemd/README.md): Systemd, a system and service manager
|
||||
- [unbound](unbound/README.md): Unbound, a validating, recursive, caching DNS resolver
|
||||
|
|
|
@ -27,8 +27,8 @@ Paramètrage avancé du serveur web Apache
|
|||
|
||||
| Description | Help | Type | Values |
|
||||
|-----------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------------------------------------------------------------------------------------------------------------------|----------|
|
||||
| **Temps d'attente des entrées/sorties avant de considérer qu'une requête a échoué** (*[apache_timeout](dictionaries/20_web.xml)*) | Temps en secondes | [number](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | 300 |
|
||||
| **Autoriser les connexions persistantes** (*[apache_keepalive](dictionaries/20_web.xml)*) | | [boolean](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | True |
|
||||
| **Temps d'attente des entrées/sorties avant de considérer qu'une requête a échoué** (*[apache_timeout](dictionaries/20_web.xml)*) | Temps en secondes | [number](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | 300 |
|
||||
| **Autoriser les connexions persistantes** (*[apache_keepalive](dictionaries/20_web.xml)*) | | [boolean](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | True |
|
||||
|
||||
|
||||
- [+]: variable is multiple
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
<file>/etc/httpd/conf/httpd.conf</file>
|
||||
<file>/etc/httpd/conf.d/risotto.conf</file>
|
||||
<file>/etc/httpd/conf.d/ssl.conf</file>
|
||||
<file>/etc/httpd/ssl/server.ca</file>
|
||||
<file>/etc/httpd/ssl/server.crt</file>
|
||||
<file>/etc/httpd/ssl/server.key</file>
|
||||
<file engine="none" source="sysuser-httpd.conf">/sysusers.d/httpd.conf</file>
|
||||
<file engine="none" source="tmpfile-httpd.conf">/tmpfiles.d/0httpd.conf</file>
|
||||
</service>
|
||||
|
|
|
@ -1 +1 @@
|
|||
PKG="$PKG mod_ssl"
|
||||
PKG="$PKG httpd mod_ssl"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
%%get_chain(%%domain_name_eth0, authority_cn=%%revprox_client_server_domainname, authority_name="InternalReverseProxy", hide=%%hide_secret)
|
|
@ -1 +0,0 @@
|
|||
%%get_certificate(%%domain_name_eth0, authority_cn=%%revprox_client_server_domainname, authority_name="InternalReverseProxy", hide=%%hide_secret)
|
|
@ -1 +0,0 @@
|
|||
%%get_private_key(%%domain_name_eth0, authority_cn=%%revprox_client_server_domainname, authority_name="InternalReverseProxy", hide=%%hide_secret)
|
|
@ -100,7 +100,7 @@ SSLProxyCipherSuite PROFILE=SYSTEM
|
|||
# require an ECC certificate which can also be configured in
|
||||
# parallel.
|
||||
# GNUNUX SSLCertificateFile /etc/pki/tls/certs/localhost.crt
|
||||
SSLCertificateFile /etc/httpd/ssl/server.crt
|
||||
SSLCertificateFile %%tls_cert_directory/revprox.crt
|
||||
|
||||
# Server Private Key:
|
||||
# If the key is not combined with the certificate, use this
|
||||
|
@ -109,7 +109,7 @@ SSLCertificateFile /etc/httpd/ssl/server.crt
|
|||
# both in parallel (to also allow the use of DSA ciphers, etc.)
|
||||
# ECC keys, when in use, can also be configured in parallel
|
||||
# GNUNUX SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
|
||||
SSLCertificateKeyFile /etc/httpd/ssl/server.key
|
||||
SSLCertificateKeyFile %%tls_key_directory/revprox.key
|
||||
|
||||
# Server Certificate Chain:
|
||||
# Point SSLCertificateChainFile at a file containing the
|
||||
|
@ -126,7 +126,7 @@ SSLCertificateKeyFile /etc/httpd/ssl/server.key
|
|||
# huge file containing all of them (file must be PEM encoded)
|
||||
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
|
||||
#>GNUNUX
|
||||
SSLCACertificateFile /etc/httpd/ssl/server.ca
|
||||
SSLCACertificateFile %%tls_ca_directory/InternalReverseProxy.crt
|
||||
#<GNUNUX
|
||||
|
||||
# Client Authentication (Type):
|
||||
|
|
|
@ -20,6 +20,7 @@ Base information of a Debian Bulleye server.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Used by
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ Base information of a Debian server.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Used by
|
||||
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
q /var/tmp 1777 root root 30d
|
||||
# Keys have good right
|
||||
d /etc/ssl/private 755 root root - -
|
||||
|
|
|
@ -20,6 +20,7 @@ Base information of a Fedora 35.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Used by
|
||||
|
||||
|
|
|
@ -20,16 +20,14 @@ Base information of a Fedora 36.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Used by
|
||||
|
||||
- [galette](../galette/README.md)
|
||||
- [peertube](../peertube/README.md)
|
||||
- [piwigo](../piwigo/README.md)
|
||||
- [dovecot](../dovecot/README.md)
|
||||
- [dotclear](../dotclear/README.md)
|
||||
- [speedtest-rs](../speedtest-rs/README.md)
|
||||
- [sensmotdire](../sensmotdire/README.md)
|
||||
- [roundcube](../roundcube/README.md)
|
||||
- [znc](../znc/README.md)
|
||||
- [vaultwarden](../vaultwarden/README.md)
|
||||
|
|
|
@ -20,6 +20,7 @@ Base information of a Fedora 37.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Used by
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@ Base information of a Fedora.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Used by
|
||||
|
||||
- [base-fedora-36](../base-fedora-36/README.md)
|
||||
- [base-fedora-35](../base-fedora-35/README.md)
|
||||
- [letsencrypt](../letsencrypt/README.md)
|
||||
- [base-fedora-37](../base-fedora-37/README.md)
|
||||
|
|
|
@ -15,6 +15,7 @@ Base information for a machine.
|
|||
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
|
||||
## Variables
|
||||
|
||||
|
@ -22,7 +23,7 @@ Base information for a machine.
|
|||
|
||||
| Description | Type |
|
||||
|-----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
||||
| Data disk size (*[data_disk_size](extras/machine/00_base.xml)*) | [number](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
| Data disk size (*[data_disk_size](extras/machine/00_base.xml)*) | [number](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
|
||||
|
||||
- [+]: variable is multiple
|
||||
|
|
|
@ -3,3 +3,4 @@ description: Base information for a machine
|
|||
depends:
|
||||
- base
|
||||
- dns-local
|
||||
- pki-tls
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</variables>
|
||||
<constraints>
|
||||
<fill name="calc_value">
|
||||
<param type="variable">domain_name_eth0</param>
|
||||
<param type="variable">server_name</param>
|
||||
<target>machine.name</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
|
|
@ -10,11 +10,11 @@ _HERE = _environ['PWD']
|
|||
_PASSWORD_DIR = _join(_HERE, 'password')
|
||||
|
||||
|
||||
def get_password(server_name: str,
|
||||
username: str,
|
||||
def get_password(username: str,
|
||||
description: str,
|
||||
type: str,
|
||||
hide: bool,
|
||||
server_name: str='none',
|
||||
length: int=20,
|
||||
temporary: bool=True,
|
||||
) -> str:
|
||||
|
|
|
@ -21,12 +21,15 @@ def get_ip(zones: dict,
|
|||
break
|
||||
else:
|
||||
raise ValueError(f'cannot find IP in domain name "{domain_name}" (for "{s_name}")')
|
||||
if not host_name in zone['hosts']:
|
||||
continue
|
||||
ret = zone['hosts'][host_name]
|
||||
if not return_list:
|
||||
return ret
|
||||
if ret not in lst:
|
||||
lst.append(ret)
|
||||
return lst
|
||||
if return_list:
|
||||
return lst
|
||||
|
||||
|
||||
@_multi_function
|
||||
|
|
|
@ -19,8 +19,8 @@ DNS client with resolution on all zones (especially outside).
|
|||
|
||||
| Description | Values | Supplier |
|
||||
|-------------------------------------------------------------|----------|-------------|
|
||||
| *[**dns_is_only_local**](dictionaries/14-dns-external.xml)* | False | |
|
||||
| *[dns_client_address](dictionaries/14-dns-external.xml)* | | ExternalDNS |
|
||||
| *[**dns_is_only_local**](dictionaries/14_dns-external.xml)* | False | |
|
||||
| *[dns_client_address](dictionaries/14_dns-external.xml)* | | ExternalDNS |
|
||||
|
||||
|
||||
- [+]: variable is multiple
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
gitea: none
|
||||
include_toc: true
|
||||
---
|
||||
|
||||
# dotclear
|
||||
|
||||
[All applications services for this dataset.](../README.md)
|
||||
|
||||
## Description
|
||||
|
||||
Dotclear an open-source web publishing software.
|
||||
|
||||
[For more informations](https://dotclear.org)
|
||||
|
||||
## Dependances
|
||||
|
||||
- [base-fedora-36](../base-fedora-36/README.md)
|
||||
- [base-fedora](../base-fedora/README.md)
|
||||
- [systemd](../systemd/README.md)
|
||||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [postgresql-client](../postgresql-client/README.md)
|
||||
- [nginx-https](../nginx-https/README.md)
|
||||
- [nginx-common](../nginx-common/README.md)
|
||||
- [reverse-proxy-client](../reverse-proxy-client/README.md)
|
||||
- [php-fpm](../php-fpm/README.md)
|
||||
- [php](../php/README.md)
|
||||
|
||||
## Variables
|
||||
|
||||
### Général (*general*)
|
||||
|
||||
#### Dotclear (*general.dotclear*)
|
||||
|
||||
| Description | Type |
|
||||
|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
|
||||
| **Adresse courriel de l'administrateur** (*[admin_mail_from](dictionaries/40_dotclear.xml)*) | [mail](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
|
||||
|
||||
- [+]: variable is multiple
|
||||
- **bold**: variable is mandatory
|
|
@ -1,8 +0,0 @@
|
|||
format: '0.1'
|
||||
description: Dotclear an open-source web publishing software
|
||||
website: https://dotclear.org
|
||||
depends:
|
||||
- base-fedora-36
|
||||
- postgresql-client
|
||||
- nginx-https
|
||||
- php-fpm
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<services>
|
||||
<service name="dotclear" target="multi-user" engine="none">
|
||||
<file>/etc/dotclear/config.php</file>
|
||||
<file source="dotclear.nginx.conf">/etc/nginx/default.d/dotclear.conf</file>
|
||||
<file source="tmpfile-dotclear.conf">/tmpfiles.d/0dotclear.conf</file>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name="dotclear" description="Dotclear">
|
||||
<variable name="admin_mail_from" type="mail" description="Adresse courriel de l'administrateur" mandatory="True"/>
|
||||
<variable name="dotclear_secret_key" type="password" hidden="True"/>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="get_password">
|
||||
<param name="server_name" type="variable">domain_name_eth0</param>
|
||||
<param name="username">secret_key</param>
|
||||
<param name="description">dotclear</param>
|
||||
<param name="type">cleartext</param>
|
||||
<param name="hide" type="variable">hide_secret</param>
|
||||
<target>dotclear_secret_key</target>
|
||||
</fill>
|
||||
</constraints>
|
||||
</rougail>
|
|
@ -1,16 +0,0 @@
|
|||
set -e
|
||||
|
||||
ORIPWD=$PWD
|
||||
mkdir -p "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share"
|
||||
cd "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share"
|
||||
wget -q "https://download.dotclear.net/latest.tar.gz"
|
||||
tar xf *tar.gz
|
||||
rm -f *tar.gz
|
||||
chown -R root: dotclear
|
||||
cd dotclear
|
||||
rmdir public
|
||||
ln -s /srv/dotclear/public public
|
||||
cd inc
|
||||
ln -s /etc/dotclear/config.php config.php
|
||||
|
||||
cd $ORIPWD
|
|
@ -1 +0,0 @@
|
|||
PKG="$PKG php-pgsql php-mbstring php-xml"
|
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Dotclear
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Database driver (mysql (deprecated, disabled in PHP7), mysqli, mysqlimb4 (full UTF-8), pgsql, sqlite)
|
||||
define('DC_DBDRIVER', 'pgsql');
|
||||
|
||||
// Database hostname (usually "localhost")
|
||||
define('DC_DBHOST', '%%pg_client_server_domainname');
|
||||
|
||||
// Database user
|
||||
define('DC_DBUSER', '%%pg_client_username');
|
||||
|
||||
// Database password
|
||||
define('DC_DBPASSWORD', '%%pg_client_password');
|
||||
|
||||
// Database name
|
||||
define('DC_DBNAME', '%%pg_client_database');
|
||||
|
||||
// Tables' prefix
|
||||
define('DC_DBPREFIX', 'dc_');
|
||||
|
||||
// Persistent database connection
|
||||
define('DC_DBPERSIST', false);
|
||||
|
||||
// Crypt key (password storage)
|
||||
define('DC_MASTER_KEY', '%%dotclear_secret_key');
|
||||
|
||||
// Admin URL. You need to set it for some features.
|
||||
%set %%location = %%revprox_client_external_domainnames[0].revprox_client_location
|
||||
define('DC_ADMIN_URL', 'https://%%revprox_client_external_domainnames[0]%%{location}admin');
|
||||
|
||||
// Admin mail from address. For password recovery and such.
|
||||
define('DC_ADMIN_MAILFROM', '%%admin_mail_from');
|
||||
|
||||
// Cookie's name
|
||||
define('DC_SESSION_NAME', 'dcxd');
|
||||
|
||||
// Session TTL
|
||||
//define('DC_SESSION_TTL','120 seconds');
|
||||
|
||||
// Plugins root
|
||||
define('DC_PLUGINS_ROOT', '/srv/dotclear/plugins');
|
||||
|
||||
// Template cache directory
|
||||
//>GNUNUX
|
||||
//define('DC_TPL_CACHE', path::real(__DIR__ . '/..') . '/cache');
|
||||
define('DC_TPL_CACHE', '/srv/dotclear/cache');
|
||||
//<GNUNUX
|
||||
|
||||
// Var directory
|
||||
define('DC_VAR', '/srv/dotclear/var');
|
||||
|
||||
// Cryptographic algorithm
|
||||
define('DC_CRYPT_ALGO', 'sha512');
|
||||
|
||||
// Vendor name
|
||||
//define('DC_VENDOR_NAME', 'Dotclear');
|
||||
|
||||
// Do not check for update
|
||||
//define('DC_NOT_UPDATE', false);
|
||||
//>GNUNUX
|
||||
define('DC_NOT_UPDATE', false);
|
||||
//<GNUNUX
|
||||
|
||||
// Update URL
|
||||
//define('DC_UPDATE_URL','https://download.dotclear.org/versions.xml');
|
||||
|
||||
// Update channel (stable, unstable, testing)
|
||||
//define('DC_UPDATE_VERSION', 'stable');
|
||||
|
||||
// Proxy config
|
||||
//define('HTTP_PROXY_HOST','127.0.0.1');
|
||||
//define('HTTP_PROXY_PORT','8080');
|
||||
|
||||
// Reverse Proxy
|
||||
//define('DC_REVERSE_PROXY',false);
|
||||
//>GNUNUX
|
||||
define('DC_REVERSE_PROXY',true);
|
||||
//<GNUNUX
|
||||
|
||||
// Show hidden media dirs
|
||||
//define('DC_SHOW_HIDDEN_DIRS', false);
|
||||
|
||||
// Store update checking
|
||||
//define('DC_STORE_NOT_UPDATE', false);
|
||||
|
||||
// If you have PATH_INFO issue, uncomment following lines
|
||||
//if (!isset($_SERVER['ORIG_PATH_INFO'])) {
|
||||
// $_SERVER['ORIG_PATH_INFO'] = '';
|
||||
//}
|
||||
//$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
|
||||
|
||||
// If you have mail problems, uncomment following lines and adapt it to your hosting configuration
|
||||
// For more information about this setting, please refer to http://doc.dotclear.net/2.0/admin/install/custom-sendmail
|
||||
//function _mail($to, $subject, $message, $headers)
|
||||
//{
|
||||
// socketMail::$smtp_relay = 'my.smtp.relay.org';
|
||||
// socketMail::mail($to, $subject, $message, $headers);
|
||||
//}
|
|
@ -1,34 +0,0 @@
|
|||
# To allow POST on static pages
|
||||
error_page 405 =200 $uri;
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains;';
|
||||
add_header Referrer-Policy no-referrer always;
|
||||
|
||||
%set %%locations = []
|
||||
%for %%revprox in %%revprox_client_external_domainnames
|
||||
%set %%location = %%revprox.revprox_client_location
|
||||
%if %%location in %%locations
|
||||
%continue
|
||||
%end if
|
||||
%%locations.append(%%location)
|
||||
location %%location {
|
||||
%if %%location == '/'
|
||||
root %slurp
|
||||
%else
|
||||
alias %slurp
|
||||
%end if
|
||||
/usr/local/share/dotclear/;
|
||||
index index.php;
|
||||
location ~ ^(?<script_name>.+?\.php)(?<path_info>/.*)?$ {
|
||||
fastcgi_pass php-fpm;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
%end for
|
|
@ -1,18 +0,0 @@
|
|||
[Unit]
|
||||
Description=Dotclear management
|
||||
After=risotto.target
|
||||
Before=nginx.service php-fpm.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/cp -f /usr/local/share/dotclear/var/.htaccess /srv/dotclear/var/
|
||||
ExecStart=/usr/bin/cp -f /usr/local/share/dotclear/cache/.htaccess /srv/dotclear/cache/
|
||||
ExecStart=/usr/bin/cp -f /usr/local/share/dotclear/plugins/.htaccess /srv/dotclear/plugins/
|
||||
ExecStart=/usr/bin/rm -rf /srv/dotclear/plugins/*
|
||||
ExecStart=/bin/bash -c '/usr/bin/cp -fr /usr/local/share/dotclear/plugins/* /srv/dotclear/plugins/'
|
||||
|
||||
User=nginx
|
||||
Group=nginx
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,4 +0,0 @@
|
|||
d /srv/dotclear/cache 770 root nginx - -
|
||||
d /srv/dotclear/public 770 root nginx - -
|
||||
d /srv/dotclear/var 770 root nginx - -
|
||||
d /srv/dotclear/plugins 770 root nginx - -
|
|
@ -1,2 +1,6 @@
|
|||
SPF : https://www.djaodjin.com/blog/postfix-dovecot-openldap.blog.html
|
||||
Postcreen : modoboa_installer/scripts/files/postfix/main.cf.tpl
|
||||
|
||||
https://github.com/progmaticltd/homebox
|
||||
|
||||
/srv/postfix/mail devrait etre vide !
|
||||
|
|
|
@ -21,6 +21,7 @@ Postfix and Dovecot as mail servers (Submission and IMAP).
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
- [relay-lmtp-client](../relay-lmtp-client/README.md)
|
||||
- [relay-mail-client](../relay-mail-client/README.md)
|
||||
- [ldap-client](../ldap-client/README.md)
|
||||
|
@ -47,23 +48,28 @@ Postfix and Dovecot as mail servers (Submission and IMAP).
|
|||
|----------------------------------------------------------|----------|
|
||||
| *[**ldapclient_family**](dictionaries/26_dovecot.xml)* | all |
|
||||
| *[**ldap_key_file_owner**](dictionaries/26_dovecot.xml)* | dovecot |
|
||||
| *[**ldap_key_file_group**](dictionaries/26_dovecot.xml)* | postfix |
|
||||
|
||||
#### Mail domain (*general.mail*)
|
||||
#### Mail configuration (*general.mail*)
|
||||
|
||||
| Description | Type | Values | Choices |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|-----------|----------------------------|
|
||||
| **Autorité de certification signant les certificats des domaines extérieurs** (*[mail_crt_provider](dictionaries/26_dovecot.xml)*) | [choice](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | autosigne | autosigne<br />letsencrypt |
|
||||
|
||||
##### Mail domain (*general.mail.domain*)
|
||||
|
||||
This a family is a leadership.
|
||||
|
||||
| Description | Type | Supplier |
|
||||
|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| **Domaine de courriel géré localement** (*[mail_domains](dictionaries/26_dovecot.xml)*) [+] | [domainname](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | LMTP:criteria |
|
||||
| *[**imap_domainname**](dictionaries/26_dovecot.xml)* | [domainname](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | |
|
||||
| *[**submission_domainname**](dictionaries/26_dovecot.xml)* | [domainname](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | |
|
||||
| **Domaine de courriel géré localement** (*[mail_domains](dictionaries/26_dovecot.xml)*) [+] | [domainname](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | LMTP:criteria |
|
||||
| *[**imap_domainname**](dictionaries/26_dovecot.xml)* | [domainname](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | |
|
||||
| *[**submission_domainname**](dictionaries/26_dovecot.xml)* | [domainname](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | |
|
||||
|
||||
#### IMAP mail server (*general.dovecot*)
|
||||
|
||||
| Description | Type | Values | Provider |
|
||||
|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|--------------|------------|
|
||||
| **Adresse interne du serveur IMAP** (*[imap_internal_address](dictionaries/26_dovecot.xml)*) | [domainname](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | <calculated> | IMAP |
|
||||
| **Adresse interne du serveur IMAP** (*[imap_internal_address](dictionaries/26_dovecot.xml)*) | [domainname](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | <calculated> | IMAP |
|
||||
|
||||
#### revprox (*general.revprox*)
|
||||
|
||||
|
|
|
@ -3,18 +3,17 @@
|
|||
<services>
|
||||
<service name="postfix" target="multi-user">
|
||||
<override/>
|
||||
<certificate format="pem" authority="External" type="server" domain="submission_domainname" provider="mail_crt_provider" certificate_type="variable">submission_domainname</certificate>
|
||||
<certificate format="pem" authority="Mail" owner="postfix" type="server">postfixlocal</certificate>
|
||||
<certificate authority="Mail" owner="postfix" type="server">postfix</certificate>
|
||||
<certificate authority="LDAP" owner="postfix" server="ldap_server_address">postfix_ldap_client</certificate>
|
||||
<file engine="none" source="sysuser-postfix.conf">/sysusers.d/1postfix.conf</file>
|
||||
<file engine="none" source="tmpfile-postfix.conf">/tmpfiles.d/0postfix.conf</file>
|
||||
<file>/etc/postfix/main.cf</file>
|
||||
<file>/etc/postfix/master.cf</file>
|
||||
<file>/etc/postfix/relay_passwd</file>
|
||||
<file>/etc/postfix/ldapsource.cf</file>
|
||||
<file>/etc/pki/ca-trust/source/anchors/ca_MailServer.crt</file>
|
||||
<file>/etc/pki/tls/certs/postfix.crt</file>
|
||||
<file owner="root" group="postfix" mode="440">/etc/pki/tls/private/postfix.key</file>
|
||||
<file>/etc/postfix/sni</file>
|
||||
<file source="postfix_sni.pem" file_type="variable" mode="400" variable="submission_domainname">postfix_pem_files</file>
|
||||
<file mode="400">/etc/postfix/certs/postfix.pem</file>
|
||||
</service>
|
||||
<service name='dovecot-init'>
|
||||
<override/>
|
||||
|
@ -24,6 +23,8 @@
|
|||
<file source='config-v1.1.xml' file_type="variable" variable="mail_domains">well_known_filenames</file>
|
||||
</service>
|
||||
<service name="dovecot" target="multi-user">
|
||||
<certificate authority="External" type="server" domain="imap_domainname" provider="mail_crt_provider" certificate_type="variable">imap_domainname</certificate>
|
||||
<certificate authority="IMAP" owner="dovecot" type="server">dovecot</certificate>
|
||||
<file engine="none" source="sysuser-dovecot.conf">/sysusers.d/1dovecot.conf</file>
|
||||
<file engine="none" source="tmpfile-dovecot.conf">/tmpfiles.d/0dovecot.conf</file>
|
||||
<file engine='none'>/etc/dovecot/conf.d/10-logging.conf</file>
|
||||
|
@ -42,11 +43,6 @@
|
|||
<file>/etc/dovecot/conf.d/auth-oauth2.conf.ext</file>
|
||||
<file>/etc/dovecot/dovecot-oauth2.conf.ext</file>
|
||||
<!--internal authentification-->
|
||||
<file>/etc/pki/ca-trust/source/anchors/ca_IMAPServer.crt</file>
|
||||
<file>/etc/pki/tls/certs/dovecot.crt</file>
|
||||
<file owner="root" group="dovecot" mode="440">/etc/pki/tls/private/dovecot.key</file>
|
||||
<file source="external_imap.crt" file_type="variable" variable="imap_domainname">external_imap_crt</file>
|
||||
<file owner="root" group="dovecot" mode="440" source="external_imap.key" file_type="variable" variable="imap_domainname">external_imap_key</file>
|
||||
<file filelist="copy_tests">/tests/imap.yml</file>
|
||||
</service>
|
||||
</services>
|
||||
|
@ -65,25 +61,24 @@
|
|||
<variable name="ldap_key_file_owner" redefine="True">
|
||||
<value>dovecot</value>
|
||||
</variable>
|
||||
<variable name="ldap_key_file_group" redefine="True">
|
||||
<value>postfix</value>
|
||||
</variable>
|
||||
</family>
|
||||
</family>
|
||||
<family name="mail" description="Mail domain" leadership="True">
|
||||
<variable name="mail_domains" type="domainname" description="Domaine de courriel géré localement" mandatory="True" multi="True" supplier="LMTP:criteria"/>
|
||||
<variable name="mail_domains_calc" type="domainname" hidden="True"/>
|
||||
<variable name="imap_domainname" type="domainname" mandatory="True"/>
|
||||
<variable name="submission_domainname" type="domainname" mandatory="True"/>
|
||||
</family>
|
||||
<family name="postfix">
|
||||
<variable name='postfix_pem_files' type="filename" hidden='True' multi='True'/>
|
||||
<family name="mail" description="Mail configuration">
|
||||
<family name="domain" description="Mail domain" leadership="True">
|
||||
<variable name="mail_domains" type="domainname" description="Domaine de courriel géré localement" mandatory="True" multi="True" supplier="LMTP:criteria"/>
|
||||
<variable name="mail_domains_calc" type="domainname" hidden="True"/>
|
||||
<variable name="imap_domainname" type="domainname" mandatory="True"/>
|
||||
<variable name="submission_domainname" type="domainname" mandatory="True"/>
|
||||
</family>
|
||||
<variable name="mail_crt_provider" type="choice" description="Autorité de certification signant les certificats des domaines extérieurs" mandatory="True">
|
||||
<value>autosigne</value>
|
||||
<choice>autosigne</choice>
|
||||
<choice>letsencrypt</choice>
|
||||
</variable>
|
||||
</family>
|
||||
<family name="dovecot" description="IMAP mail server">
|
||||
<variable name="imap_internal_address" type="domainname" description="Adresse interne du serveur IMAP" mandatory="True" provider="IMAP"/>
|
||||
<variable name="well_known_filenames" type="filename" hidden='True' multi="True"/>
|
||||
<variable name='external_imap_crt' type="filename" hidden='True' multi='True'/>
|
||||
<variable name='external_imap_key' type="filename" hidden='True' multi='True'/>
|
||||
</family>
|
||||
<family name="revprox">
|
||||
<family name="revprox_client">
|
||||
|
@ -98,30 +93,6 @@
|
|||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="calc_value">
|
||||
<param>/etc/pki/tls/certs/imap_</param>
|
||||
<param type="variable">imap_domainname</param>
|
||||
<param>.crt</param>
|
||||
<param name="join"></param>
|
||||
<param name="multi" type="boolean">True</param>
|
||||
<target>external_imap_crt</target>
|
||||
</fill>
|
||||
<fill name="calc_value">
|
||||
<param>/etc/pki/tls/private/imap_</param>
|
||||
<param type="variable">imap_domainname</param>
|
||||
<param>.key</param>
|
||||
<param name="join"></param>
|
||||
<param name="multi" type="boolean">True</param>
|
||||
<target>external_imap_key</target>
|
||||
</fill>
|
||||
<fill name="calc_value">
|
||||
<param>/etc/postfix/certs/</param>
|
||||
<param type="variable">submission_domainname</param>
|
||||
<param>.pem</param>
|
||||
<param name="join"></param>
|
||||
<param name="multi" type="boolean">True</param>
|
||||
<target>postfix_pem_files</target>
|
||||
</fill>
|
||||
<fill name="calc_value">
|
||||
<param type="variable">domain_name_eth0</param>
|
||||
<target>imap_internal_address</target>
|
||||
|
|
|
@ -18,13 +18,13 @@ ssl_cert = </etc/pki/tls/certs/dovecot.crt
|
|||
ssl_key = </etc/pki/tls/private/dovecot.key
|
||||
%for %%mail in %%mail_domains
|
||||
local_name %%mail.imap_domainname {
|
||||
ssl_cert = </etc/pki/tls/certs/imap_%%{mail.imap_domainname}.crt
|
||||
ssl_key = </etc/pki/tls/private/imap_%%{mail.imap_domainname}.key
|
||||
ssl_cert = %echo '<' + %%tls_cert_directory + '/' + %%mail.imap_domainname + '.crt'
|
||||
ssl_key = %echo '<' + %%tls_key_directory + '/' + %%mail.imap_domainname + '.key'
|
||||
}
|
||||
%end for
|
||||
local_name %%domain_name_eth0 {
|
||||
ssl_cert = </etc/pki/tls/certs/dovecot.crt
|
||||
ssl_key = </etc/pki/tls/private/dovecot.key
|
||||
ssl_cert = %echo '<' + %%tls_cert_directory + '/dovecot.crt'
|
||||
ssl_key = %echo '<' + %%tls_key_directory + '/dovecot.key'
|
||||
}
|
||||
#<GNUNUX
|
||||
|
||||
|
@ -50,7 +50,7 @@ local_name %%domain_name_eth0 {
|
|||
# large CA bundles, because it leads to excessive memory usage.
|
||||
#ssl_client_ca_dir =
|
||||
#ssl_client_ca_file =
|
||||
ssl_client_ca_file = /etc/pki/ca-trust/source/anchors/ca_IMAPServer.crt
|
||||
ssl_client_ca_file = %%tls_ca_directory/IMAP.crt
|
||||
|
||||
# Require valid cert when connecting to a remote server
|
||||
#ssl_client_require_valid_cert = yes
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
%%get_chain(%%domain_name_eth0, %%domain_name_eth0, "IMAPServer", hide=%%hide_secret)
|
|
@ -1 +0,0 @@
|
|||
%%get_chain(%%domain_name_eth0, %%domain_name_eth0, "MailServer", hide=%%hide_secret)
|
|
@ -61,9 +61,9 @@ dnpass = %%ldapclient_user_password
|
|||
# Valid values: never, hard, demand, allow, try
|
||||
#tls_require_cert =
|
||||
#>GNUNUX
|
||||
tls_cert_file = %%ldap_cert_file
|
||||
tls_key_file = %%ldap_key_file
|
||||
tls_ca_cert_file = %%ldap_ca_file
|
||||
tls_cert_file = %%tls_cert_directory/ldap_client.crt
|
||||
tls_key_file = %%tls_key_directory/ldap_client.key
|
||||
tls_ca_cert_file = %%tls_ca_directory/LDAP.crt
|
||||
tls_require_cert = hard
|
||||
#>GNUNUX
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
%set %%extra_domainnames = []
|
||||
%for %%idx in %%range(%%len(%%zones_list))
|
||||
%if not idx
|
||||
%continue
|
||||
%end if
|
||||
%%extra_domainnames.append(%%getVar('domain_name_eth' + %%str(%%idx)))
|
||||
%end for
|
||||
%%get_certificate(%%domain_name_eth0, 'IMAPServer', extra_domainnames=%%extra_domainnames, hide=%%hide_secret)
|
|
@ -1 +0,0 @@
|
|||
%%get_private_key(cn=%%domain_name_eth0, authority_name='IMAPServer', hide=%%hide_secret)
|
|
@ -1,8 +1,8 @@
|
|||
server_host = ldaps://%%ldap_server_address
|
||||
server_port = %%ldap_port
|
||||
tls_cert = %%ldap_cert_file
|
||||
tls_key = %%ldap_key_file
|
||||
tls_ca_cert_file = %%ldap_ca_file
|
||||
tls_cert = %%tls_cert_directory/postfix_ldap_client.crt
|
||||
tls_key = %%tls_key_directory/postfix_ldap_client.key
|
||||
tls_ca_cert_file = %%tls_ca_directory/LDAP.crt
|
||||
tls_require_cert = yes
|
||||
version = 3
|
||||
bind = yes
|
||||
|
|
|
@ -306,7 +306,7 @@ smtpd_recipient_restrictions =
|
|||
#mynetworks = 168.100.3.0/28, 127.0.0.0/8
|
||||
#mynetworks = $config_directory/mynetworks
|
||||
#mynetworks = hash:/etc/postfix/network_table
|
||||
mynetworks = 172.0.0.0/8
|
||||
mynetworks = 127.0.0.0/8
|
||||
|
||||
# The relay_domains parameter restricts what destinations this system will
|
||||
# relay mail to. See the smtpd_recipient_restrictions description in
|
||||
|
@ -476,6 +476,9 @@ recipient_delimiter = +
|
|||
#
|
||||
#mail_spool_directory = /var/mail
|
||||
#mail_spool_directory = /var/spool/mail
|
||||
#>GNUNUX
|
||||
mail_spool_directory = /srv/postfix/mail
|
||||
#<GNUNUX
|
||||
|
||||
# The mailbox_command parameter specifies the optional external
|
||||
# command to use instead of mailbox delivery. The command is run as
|
||||
|
@ -739,16 +742,15 @@ readme_directory = /usr/share/doc/postfix/README_FILES
|
|||
# in PEM format. Intermediate certificates should be included in general,
|
||||
# the server certificate first, then the issuing CA(s) (bottom-up order).
|
||||
#
|
||||
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.crt
|
||||
smtpd_tls_cert_file = %%tls_cert_directory/postfix.crt
|
||||
|
||||
# The full pathname of a file with the Postfix SMTP server RSA private key
|
||||
# in PEM format. The private key must be accessible without a pass-phrase,
|
||||
# i.e. it must not be encrypted.
|
||||
#
|
||||
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
|
||||
smtpd_tls_key_file = %%tls_key_directory/postfix.key
|
||||
|
||||
smtpd_tls_CApath = /etc/pki/tls/certs
|
||||
smtpd_tls_CAfile = /etc/pki/ca-trust/source/anchors/ca_MailServer.crt
|
||||
smtpd_tls_CApath = %%tls_ca_directory
|
||||
#>GNUNUX
|
||||
tls_server_sni_maps = hash:/etc/postfix/sni
|
||||
#<GNUNUX
|
||||
|
@ -760,13 +762,13 @@ smtpd_tls_security_level = may
|
|||
# Directory with PEM format Certification Authority certificates that the
|
||||
# Postfix SMTP client uses to verify a remote SMTP server certificate.
|
||||
#
|
||||
smtp_tls_CApath = /etc/pki/tls/certs
|
||||
smtp_tls_CApath = %%tls_ca_directory
|
||||
|
||||
# The full pathname of a file containing CA certificates of root CAs
|
||||
# trusted to sign either remote SMTP server certificates or intermediate CA
|
||||
# certificates.
|
||||
#
|
||||
smtp_tls_CAfile = /etc/pki/ca-trust/source/anchors/ca_MailServer.crt
|
||||
smtp_tls_CAfile = %%tls_ca_directory/Mail.crt
|
||||
|
||||
# Use TLS if this is supported by the remote SMTP server, otherwise use
|
||||
# plaintext (opportunistic TLS outbound).
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
%set %%extra_domainnames = []
|
||||
%for %%idx in %%range(%%len(%%zones_list))
|
||||
%if not %%idx
|
||||
%continue
|
||||
%end if
|
||||
%%extra_domainnames.append(%%getVar('domain_name_eth' + %%str(%%idx)))
|
||||
%end for
|
||||
%%get_certificate(%%domain_name_eth0, "MailServer", extra_domainnames=%%extra_domainnames, hide=%%hide_secret)
|
|
@ -1 +0,0 @@
|
|||
%%get_private_key(cn=%%domain_name_eth0, authority_name='MailServer', hide=%%hide_secret)
|
|
@ -1,2 +0,0 @@
|
|||
%%get_private_key(cn=%%domain_name_eth0, authority_name='MailServer', hide=%%hide_secret)
|
||||
%%get_certificate(cn=%%domain_name_eth0, authority_name="MailServer", hide=%%hide_secret)
|
|
@ -1,4 +1,4 @@
|
|||
%for %%name in %%mail_domains
|
||||
%%name.submission_domainname /etc/postfix/certs/%%{name.submission_domainname}.pem
|
||||
%%name.submission_domainname %%tls_key_directory/%%{name.submission_domainname}.pem
|
||||
%end for
|
||||
%%domain_name_eth0 /etc/postfix/certs/postfix.pem
|
||||
%%domain_name_eth0 %%tls_key_directory/postfixlocal.pem
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
d /srv/postfix 750 postfix postfix - -
|
||||
d /srv/postfix/data 750 postfix postfix - -
|
||||
d /srv/postfix/spool 755 root root - -
|
||||
d /srv/postfix/mail 750 root root - -
|
||||
d /var/lib/misc/ 755 root root - -
|
||||
|
|
|
@ -21,6 +21,7 @@ Forgejo, a community managed lightweight code hosting solution.
|
|||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [pki-tls](../pki-tls/README.md)
|
||||
- [postgresql-client](../postgresql-client/README.md)
|
||||
- [reverse-proxy-client](../reverse-proxy-client/README.md)
|
||||
- [relay-mail-client](../relay-mail-client/README.md)
|
||||
|
@ -49,8 +50,8 @@ Git forge Forgejo
|
|||
|
||||
| Description | Values | Type |
|
||||
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
||||
| **Titre de la forge** (*[forgejo_title](dictionaries/31_forgejo.xml)*) | Forgejo : Au-delà du développement. Nous forgeons. | [string](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
| **Les courriels sont envoyés à partir de cet adresse** (*[forgejo_mail_sender](dictionaries/31_forgejo.xml)*) | | [mail](https://cloud.silique.fr/gitea/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
| **Titre de la forge** (*[forgejo_title](dictionaries/31_forgejo.xml)*) | Forgejo : Au-delà du développement. Nous forgeons. | [string](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
| **Les courriels sont envoyés à partir de cet adresse** (*[forgejo_mail_sender](dictionaries/31_forgejo.xml)*) | | [mail](https://forge.cloud.silique.fr/risotto/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) |
|
||||
|
||||
#### revprox (*general.revprox*)
|
||||
|
||||
|
@ -58,7 +59,6 @@ Git forge Forgejo
|
|||
|----------------------------------------------------------------|----------|
|
||||
| *[**revprox_client_port**](dictionaries/31_forgejo.xml)* | 3000 |
|
||||
| *[**revprox_client_cert_owner**](dictionaries/31_forgejo.xml)* | forgejo |
|
||||
| *[**revprox_client_cert_group**](dictionaries/31_forgejo.xml)* | forgejo |
|
||||
|
||||
##### revprox_client (*general.revprox.revprox_client*)
|
||||
|
||||
|
@ -83,6 +83,12 @@ Git forge Forgejo
|
|||
|---------------------------------------------------------|--------------|
|
||||
| *[oauth2_client_external](dictionaries/31_forgejo.xml)* | <calculated> |
|
||||
|
||||
#### postgresql (*general.postgresql*)
|
||||
|
||||
| Description | Values |
|
||||
|----------------------------------------------------------|----------|
|
||||
| *[**pg_client_key_owner**](dictionaries/31_forgejo.xml)* | forgejo |
|
||||
|
||||
|
||||
- [+]: variable is multiple
|
||||
- **bold**: variable is mandatory
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
<variable name="revprox_client_cert_owner" redefine="True">
|
||||
<value>forgejo</value>
|
||||
</variable>
|
||||
<variable name="revprox_client_cert_group" redefine="True">
|
||||
<value>forgejo</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name="oauth2_client">
|
||||
<variable name="oauth2_is_client_application" redefine='True'>
|
||||
|
|
|
@ -319,8 +319,8 @@ OFFLINE_MODE = true
|
|||
;CERT_FILE = https/cert.pem
|
||||
;KEY_FILE = https/key.pem
|
||||
;>GNUNUX
|
||||
CERT_FILE = %%revprox_client_cert_file
|
||||
KEY_FILE = %%revprox_client_key_file
|
||||
CERT_FILE = %%tls_cert_directory/revprox.crt
|
||||
KEY_FILE = %%tls_key_directory/revprox.key
|
||||
;<GNUNUX
|
||||
;;
|
||||
;; Root directory containing templates and static files.
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
gitea: none
|
||||
include_toc: true
|
||||
---
|
||||
|
||||
# galette
|
||||
|
||||
[All applications services for this dataset.](../README.md)
|
||||
|
||||
## Description
|
||||
|
||||
Galette, a membership management web application towards non profit organizations.
|
||||
|
||||
[For more informations](https://galette.eu/)
|
||||
|
||||
## Dependances
|
||||
|
||||
- [base-fedora-36](../base-fedora-36/README.md)
|
||||
- [base-fedora](../base-fedora/README.md)
|
||||
- [systemd](../systemd/README.md)
|
||||
- [base-machine](../base-machine/README.md)
|
||||
- [base](../base/README.md)
|
||||
- [dns-local](../dns-local/README.md)
|
||||
- [mariadb-client](../mariadb-client/README.md)
|
||||
- [nginx-https](../nginx-https/README.md)
|
||||
- [nginx-common](../nginx-common/README.md)
|
||||
- [reverse-proxy-client](../reverse-proxy-client/README.md)
|
||||
- [php-fpm](../php-fpm/README.md)
|
||||
- [php](../php/README.md)
|
||||
|
||||
## Variables
|
||||
|
||||
### Machine (*machine*)
|
||||
|
||||
| Description | Values |
|
||||
|-----------------------------------------------------|----------|
|
||||
| *[**var_size**](extras/machine/20_sensmotdire.xml)* | 256 |
|
||||
| *[**add_tmp**](extras/machine/20_sensmotdire.xml)* | False |
|
||||
| *[**add_srv**](extras/machine/20_sensmotdire.xml)* | False |
|
||||
| *[**add_swap**](extras/machine/20_sensmotdire.xml)* | False |
|
||||
|
||||
|
||||
- [+]: variable is multiple
|
||||
- **bold**: variable is mandatory
|
|
@ -1,8 +0,0 @@
|
|||
format: '0.1'
|
||||
description: Galette, a membership management web application towards non profit organizations
|
||||
website: https://galette.eu/
|
||||
depends:
|
||||
- base-fedora-36
|
||||
- mariadb-client
|
||||
- nginx-https
|
||||
- php-fpm
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<services>
|
||||
<service name="galette" manage="False">
|
||||
<file>/etc/galette/config.inc.php</file>
|
||||
<file source="galette.nginx.conf">/etc/nginx/default.d/galette.conf</file>
|
||||
</service>
|
||||
</services>
|
||||
</rougail>
|
|
@ -1,8 +0,0 @@
|
|||
set -e
|
||||
|
||||
mkdir -p "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share"
|
||||
cp -a $IMAGE_DIR_RECIPIENT_IMAGE/postinstall/galette "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share"
|
||||
chown -R root: "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share/galette"
|
||||
ln -s /etc/galette/config.inc.php "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share/galette/includes/config.inc.php"
|
||||
|
||||
cd $ORIPWD
|
|
@ -1,810 +0,0 @@
|
|||
<?php
|
||||
/* ajouter_adherent.php
|
||||
* - Saisie d'un adhérent
|
||||
* Copyright (c) 2004 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
include("includes/config.inc.php");
|
||||
include(WEB_ROOT."includes/database.inc.php");
|
||||
include(WEB_ROOT."includes/functions.inc.php");
|
||||
include(WEB_ROOT."includes/lang.inc.php");
|
||||
include(WEB_ROOT."includes/session.inc.php");
|
||||
|
||||
if ($_SESSION["logged_status"]==0)
|
||||
{
|
||||
header("location: index.php");
|
||||
die();
|
||||
}
|
||||
|
||||
// On vérifie si on a une référence => modif ou création
|
||||
$values = Array();
|
||||
$id_adh = "";
|
||||
$values['date_crea_adh'] = "";
|
||||
if (isset($_GET["id_adh"]))
|
||||
if (is_numeric($_GET["id_adh"]))
|
||||
$id_adh = $_GET["id_adh"];
|
||||
if (isset($_POST["id_adh"]))
|
||||
if (is_numeric($_POST["id_adh"]))
|
||||
$id_adh = $_POST["id_adh"];
|
||||
|
||||
// Si c'est un user qui est loggé, on va à sa fiche
|
||||
if ($_SESSION["admin_status"]!=1)
|
||||
$id_adh = $_SESSION["logged_id_adh"];
|
||||
$values['id_adh'] = $id_adh;
|
||||
// variables d'erreur (pour affichage)
|
||||
$error_detected = "";
|
||||
$warning_detected = "";
|
||||
$confirm_detected = "";
|
||||
|
||||
//
|
||||
// DEBUT parametrage des champs
|
||||
// On recupere de la base la longueur et les flags des champs
|
||||
// et on initialise des valeurs par defaut
|
||||
|
||||
// recuperation de la liste de champs de la table
|
||||
$fields = $DB->MetaColumns(PREFIX_DB."adherents");
|
||||
foreach ($fields as $champ => $proprietes)
|
||||
{
|
||||
$proprietes_arr = get_object_vars($proprietes);
|
||||
// on obtient name, max_length, type, not_null, has_default, primary_key,
|
||||
// auto_increment et binary
|
||||
|
||||
$fieldname = $proprietes_arr["name"];
|
||||
|
||||
// on ne met jamais a jour id_adh
|
||||
if ($fieldname!="id_adh" && $fieldname!="date_echeance")
|
||||
$$fieldname= "";
|
||||
|
||||
$fieldlen = $fieldname."_len";
|
||||
$fieldreq = $fieldname."_req";
|
||||
|
||||
// definissons aussi la longueur des input text
|
||||
$max_tmp = $proprietes_arr["max_length"];
|
||||
if ($max_tmp == "-1")
|
||||
$max_tmp = 10;
|
||||
$fieldlen = $fieldname."_len";
|
||||
$$fieldlen=$max_tmp;
|
||||
|
||||
// et s'ils sont obligatoires (à partir de la base)
|
||||
if ($proprietes_arr["not_null"]==1)
|
||||
$$fieldreq = "style=\"color: #FF0000;\"";
|
||||
else
|
||||
$$fieldreq = "";
|
||||
}
|
||||
reset($fields);
|
||||
|
||||
// et les valeurs par defaut
|
||||
$id_statut = "4";
|
||||
$values['titre_adh'] = "1";
|
||||
|
||||
//
|
||||
// FIN parametrage des champs
|
||||
//
|
||||
|
||||
//
|
||||
// Validation du formulaire
|
||||
//
|
||||
|
||||
if (isset($_POST["valid"]))
|
||||
{
|
||||
// verification de champs
|
||||
$update_string = "";
|
||||
$insert_string_fields = "";
|
||||
$insert_string_values = "";
|
||||
|
||||
// recuperation de la liste de champs de la table
|
||||
foreach ($fields as $champ => $proprietes)
|
||||
{
|
||||
$proprietes_arr = get_object_vars($proprietes);
|
||||
// on obtient name, max_length, type, not_null, has_default, primary_key,
|
||||
// auto_increment et binary
|
||||
|
||||
$fieldname = $proprietes_arr["name"];
|
||||
|
||||
// on précise les champs non modifiables
|
||||
if (
|
||||
($_SESSION["admin_status"]==1 && $fieldname!="id_adh"
|
||||
&& $fieldname!="date_echeance") ||
|
||||
($_SESSION["admin_status"]==0 && $fieldname!="date_crea_adh"
|
||||
&& $fieldname!="panier_adh"
|
||||
&& $fieldname!="pain_adh"
|
||||
&& $fieldname!="volaille_adh"
|
||||
&& $fieldname!="chevre_adh"
|
||||
&& $fieldname!="boeuf_adh"
|
||||
&& $fieldname!="veau_adh"
|
||||
&& $fieldname!="cochon_adh"
|
||||
&& $fieldname!="farine_adh"
|
||||
&& $fieldname!="id_adh"
|
||||
&& $fieldname!="titre_adh"
|
||||
&& $fieldname!="id_statut"
|
||||
&& $fieldname!="nom_adh"
|
||||
&& $fieldname!="prenom_adh"
|
||||
&& $fieldname!="activite_adh"
|
||||
&& $fieldname!="bool_exempt_adh"
|
||||
&& $fieldname!="bool_admin_adh"
|
||||
&& $fieldname!="date_echeance"
|
||||
&& $fieldname!="info_adh")
|
||||
)
|
||||
{
|
||||
if (isset($_POST[$fieldname]))
|
||||
$post_value=trim($_POST[$fieldname]);
|
||||
else
|
||||
$post_value="";
|
||||
// on declare les variables pour la présaisie en cas d'erreur
|
||||
$values[$fieldname] = htmlentities(stripslashes($post_value),ENT_QUOTES);
|
||||
$fieldreq = $fieldname."_req";
|
||||
|
||||
// vérification de la présence des champs obligatoires
|
||||
if ($$fieldreq!="" && $post_value=="")
|
||||
$error_detected .= "<LI>"._T("- Champ obligatoire non renseigné.")."</LI>";
|
||||
else
|
||||
{
|
||||
// validation des dates
|
||||
if($proprietes_arr["type"]=="date" && $post_value!="")
|
||||
{
|
||||
if (preg_match("/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/", $post_value, $array_jours) || $post_value=="")
|
||||
{
|
||||
if (checkdate($array_jours[2],$array_jours[1],$array_jours[3]) || $post_value=="")
|
||||
// $value=$DB->DBDate(mktime(0,0,0,$array_jours[2],$array_jours[1],$array_jours[3]));
|
||||
$value = $DB->DBDate($array_jours[3].'/'.$array_jours[2].'/'.$array_jours[1]);
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Date non valide !")."</LI>";
|
||||
}
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Mauvais format de date (jj/mm/aaaa) !")."</LI>";
|
||||
}
|
||||
elseif ($fieldname=="email_adh")
|
||||
{
|
||||
$post_value=strtolower($post_value);
|
||||
if (!is_valid_email($post_value) && $post_value!="")
|
||||
$error_detected .= "<LI>"._T("- Adresse E-mail non valide !")."</LI>";
|
||||
else
|
||||
$value = $DB->qstr($post_value, true);
|
||||
|
||||
if ($post_value=="" && isset($_POST["mail_confirm"]))
|
||||
$error_detected .= "<LI>"._T("- Vous ne pouvez pas envoyer de confirmation par mail si l'adhérent n'a pas d'adresse !")."</LI>";
|
||||
}
|
||||
elseif ($fieldname=="url_adh")
|
||||
{
|
||||
if (!is_valid_web_url($post_value) && $post_value!="" && $post_value!="http://")
|
||||
$error_detected .= "<LI>"._T("- Adresse web non valide ! Oubli du http:// ?")."</LI>";
|
||||
else
|
||||
{
|
||||
if ($post_value=="http://")
|
||||
$post_value="";
|
||||
$value = $DB->qstr($post_value, true);
|
||||
}
|
||||
}
|
||||
elseif ($fieldname=="login_adh")
|
||||
{
|
||||
if (strlen($post_value)<4)
|
||||
$error_detected .= "<LI>"._T("- L'identifiant doit être composé d'au moins 4 caractères !")."</LI>";
|
||||
else
|
||||
{
|
||||
// on vérifie que le login n'est pas déjà utilisé
|
||||
$requete = "SELECT id_adh
|
||||
FROM ".PREFIX_DB."adherents
|
||||
WHERE login_adh=". $DB->qstr($post_value, true);
|
||||
if ($id_adh!="")
|
||||
$requete .= " AND id_adh!=" . $DB->qstr($id_adh, true);
|
||||
echo $requete;
|
||||
$result = $DB->Execute($requete);
|
||||
if (!$result->EOF || $post_value==PREF_ADMIN_LOGIN)
|
||||
$error_detected .= "<LI>"._T("- Cet identifiant est déjà utilisé par un autre adhérent !")."</LI>";
|
||||
else
|
||||
$value = $DB->qstr($post_value, true);
|
||||
}
|
||||
}
|
||||
elseif ($fieldname=="mdp_adh")
|
||||
{
|
||||
if (strlen($post_value)<4)
|
||||
$error_detected .= "<LI>"._T("- Le mot de passe doit être composé d'au moins 4 caractères !")."</LI>";
|
||||
else
|
||||
$value = $DB->qstr($post_value, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// on se contente d'escaper le html et les caracteres speciaux
|
||||
$value = $DB->qstr($post_value, true);
|
||||
}
|
||||
|
||||
// mise à jour des chaines d'insertion/update
|
||||
if ($value=="''")
|
||||
$value="NULL";
|
||||
$update_string .= ",".$fieldname."=".$value;
|
||||
$insert_string_fields .= ",".$fieldname;
|
||||
$insert_string_values .= ",".$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
reset($fields);
|
||||
|
||||
// modif ou ajout
|
||||
if ($error_detected=="")
|
||||
{
|
||||
if ($id_adh!="")
|
||||
{
|
||||
// modif
|
||||
|
||||
$requete = "UPDATE ".PREFIX_DB."adherents
|
||||
SET " . substr($update_string,1) . "
|
||||
WHERE id_adh=" . $id_adh;
|
||||
$DB->Execute("SET NAMES utf8");
|
||||
$DB->Execute($requete);
|
||||
$DB->Execute("SET NAMES latin1");
|
||||
$result = $DB->Execute("SET NAMES latin1");
|
||||
dblog(_T("Mise à jour de la fiche adhérent :")." ".strtoupper($_POST["nom_adh"])." ".$_POST["prenom_adh"], $requete);
|
||||
|
||||
$date_fin = get_echeance($DB, $id_adh);
|
||||
if ($date_fin!="")
|
||||
// $date_fin_update = $DB->DBDate(mktime(0,0,0,$date_fin[1],$date_fin[0],$date_fin[2]));
|
||||
$date_fin_update = $DB->DBDate($date_fin[2].'/'.$date_fin[1].'/'.$date_fin[0]);
|
||||
else
|
||||
$date_fin_update = "NULL";
|
||||
$requete = "UPDATE ".PREFIX_DB."adherents
|
||||
SET date_echeance=".$date_fin_update."
|
||||
WHERE id_adh=" . $id_adh;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ajout
|
||||
$insert_string_fields = substr($insert_string_fields,1);
|
||||
$insert_string_values = substr($insert_string_values,1);
|
||||
$requete = "INSERT INTO ".PREFIX_DB."adherents
|
||||
(" . $insert_string_fields . ")
|
||||
VALUES (" . $insert_string_values . ")";
|
||||
dblog(_T("Ajout de la fiche adhérent :")." ".strtoupper($_POST["nom_adh"])." ".$_POST["prenom_adh"], $requete);
|
||||
|
||||
}
|
||||
if ($DB->Execute($requete) === false) {
|
||||
print 'error inserting: '. $DB->ErrorMsg().'<BR>';
|
||||
return;
|
||||
};
|
||||
// il est temps d'envoyer un mail
|
||||
if (isset($_POST["mail_confirm"]))
|
||||
if ($_POST["mail_confirm"]=="1")
|
||||
if ($email_adh!="")
|
||||
{
|
||||
$mail_subject = _T("Vos identifiants Galette");
|
||||
$mail_text = _T("Bonjour,")."\n";
|
||||
$mail_text .= "\n";
|
||||
$mail_text .= _T("Vous venez d'être inscrit sur le système de gestion d'adhérents de l'association.")."\n";
|
||||
$mail_text .= _T("Il vous est désormais possible de suivre en temps réel l'état de votre adhésion")."\n";
|
||||
$mail_text .= _T("et de mettre à jour vos coordonnées par l'interface web prévue à cet effet.")."\n";
|
||||
$mail_text .= "\n";
|
||||
$mail_text .= _T("Veuillez vous identifier à cette adresse :")."\n";
|
||||
$mail_text .= "http://".$_SERVER["SERVER_NAME"].dirname($_SERVER["REQUEST_URI"])."\n";
|
||||
$mail_text .= "\n";
|
||||
$mail_text .= _T("Identifiant :")." ".custom_html_entity_decode($values['login_adh'])."\n";
|
||||
$mail_text .= _T("Mot de passe :")." ".custom_html_entity_decode($values['mdp_adh'])."\n";
|
||||
$mail_text .= "\n";
|
||||
$mail_text .= _T("A très bientôt !")."\n";
|
||||
$mail_text .= "\n";
|
||||
$mail_text .= _T("(ce mail est un envoi automatique)")."\n";
|
||||
$mail_headers = "From: ".PREF_EMAIL_NOM." <".PREF_EMAIL.">\n";
|
||||
mail ($email_adh,$mail_subject,$mail_text, $mail_headers);
|
||||
}
|
||||
|
||||
// récupération du max pour insertion photo
|
||||
// ou passage en mode modif apres insertion
|
||||
if ($id_adh=="")
|
||||
{
|
||||
$requete = "SELECT max(id_adh)
|
||||
AS max
|
||||
FROM ".PREFIX_DB."adherents";
|
||||
$max = $DB->Execute($requete);
|
||||
$id_adh_new = $max->fields["max"];
|
||||
}
|
||||
else
|
||||
$id_adh_new = $id_adh;
|
||||
|
||||
if (isset($_FILES["photo"]["tmp_name"]))
|
||||
if ($_FILES["photo"]["tmp_name"]!="none" &&
|
||||
$_FILES["photo"]["tmp_name"]!="")
|
||||
{
|
||||
|
||||
if ($_FILES['photo']['type']=="image/jpeg" ||
|
||||
(function_exists("ImageCreateFromGif") && $_FILES['photo']['type']=="image/gif") ||
|
||||
$_FILES['photo']['type']=="image/png" ||
|
||||
$_FILES['photo']['type']=="image/x-png")
|
||||
{
|
||||
$tmp_name = $HTTP_POST_FILES["photo"]["tmp_name"];
|
||||
|
||||
// extension du fichier (en fonction du type mime)
|
||||
if ($_FILES['photo']['type']=="image/jpeg")
|
||||
$ext_image = ".jpg";
|
||||
if ($_FILES['photo']['type']=="image/png" || $_FILES['photo']['type']=="image/x-png")
|
||||
$ext_image = ".png";
|
||||
if ($_FILES['photo']['type']=="image/gif")
|
||||
$ext_image = ".gif";
|
||||
|
||||
// suppression ancienne photo
|
||||
// NB : une verification sur le type de $id_adh permet d'eviter une faille
|
||||
// du style $id_adh = "../../../image"
|
||||
@unlink(WEB_ROOT . "photos/".$id_adh_new.".jpg");
|
||||
@unlink(WEB_ROOT . "photos/".$id_adh_new.".gif");
|
||||
@unlink(WEB_ROOT . "photos/".$id_adh_new.".jpg");
|
||||
@unlink(WEB_ROOT . "photos/tn_".$id_adh_new.".jpg");
|
||||
@unlink(WEB_ROOT . "photos/tn_".$id_adh_new.".gif");
|
||||
@unlink(WEB_ROOT . "photos/tn_".$id_adh_new.".jpg");
|
||||
|
||||
// copie fichier temporaire
|
||||
if (!@move_uploaded_file($tmp_name,WEB_ROOT . "photos/".$id_adh_new.$ext_image))
|
||||
$warning_detected .= "<LI>"._T("- La photo semble ne pas avoir été transmise correstement. L'enregistrement a cependant été effectué.")."</LI>";
|
||||
else
|
||||
resizeimage(WEB_ROOT . "photos/".$id_adh_new.$ext_image,WEB_ROOT . "photos/tn_".$id_adh_new.$ext_image,130,130);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function_exists("imagegif"))
|
||||
$warning_detected .= "<LI>"._T("- Le fichier transmis n'est pas une image valide (GIF, PNG ou JPEG). L'enregistrement a cependant été effectué.")."</LI>";
|
||||
else
|
||||
$warning_detected .= "<LI>"._T("- Le fichier transmis n'est pas une image valide (PNG ou JPEG). L'enregistrement a cependant été effectué.")."</LI>";
|
||||
}
|
||||
}
|
||||
|
||||
// retour à la liste ou passage à la contribution
|
||||
if ($warning_detected=="" && $id_adh=="")
|
||||
{
|
||||
header("location: ajouter_contribution.php?id_adh=".$id_adh_new);
|
||||
die();
|
||||
}
|
||||
elseif ($warning_detected=="" && !isset($_FILES["photo"]))
|
||||
{
|
||||
header("location: gestion_adherents.php");
|
||||
die();
|
||||
}
|
||||
elseif ($warning_detected=="" && ($_FILES["photo"]["tmp_name"]=="none" || $_FILES["photo"]["tmp_name"]==""))
|
||||
{
|
||||
header("location: gestion_adherents.php");
|
||||
die();
|
||||
}
|
||||
$id_adh=$id_adh_new;
|
||||
}
|
||||
}
|
||||
|
||||
// suppression photo
|
||||
if (isset($_POST["del_photo"]))
|
||||
{
|
||||
@unlink(WEB_ROOT . "photos/" . $id_adh . ".jpg");
|
||||
@unlink(WEB_ROOT . "photos/" . $id_adh . ".png");
|
||||
@unlink(WEB_ROOT . "photos/" . $id_adh . ".gif");
|
||||
@unlink(WEB_ROOT . "photos/tn_" . $id_adh . ".jpg");
|
||||
@unlink(WEB_ROOT . "photos/tn_" . $id_adh . ".png");
|
||||
@unlink(WEB_ROOT . "photos/tn_" . $id_adh . ".gif");
|
||||
}
|
||||
|
||||
//
|
||||
// Pré-remplissage des champs
|
||||
// avec des valeurs issues de la base
|
||||
// -> donc uniquement si l'enregistrement existe et que le formulaire
|
||||
// n'a pas déja été posté avec des erreurs (pour pouvoir corriger)
|
||||
|
||||
if (!isset($_POST["valid"]) || (isset($_POST["valid"]) && $error_detected==""))
|
||||
if ($id_adh != "")
|
||||
|
||||
|
||||
{
|
||||
// recup des données
|
||||
$requete = "SELECT *
|
||||
FROM ".PREFIX_DB."adherents
|
||||
WHERE id_adh=$id_adh";
|
||||
$result = $DB->Execute($requete);
|
||||
if ($result->EOF)
|
||||
{
|
||||
header("location: index.php");
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// recuperation de la liste de champs de la table
|
||||
//$fields = &$DB->MetaColumns(PREFIX_DB."cotisations");
|
||||
foreach ($fields as $champ => $proprietes)
|
||||
{
|
||||
//echo $proprietes_arr["name"]." -- (".$result->fields[$proprietes_arr["name"]].")<br>";
|
||||
|
||||
|
||||
$val="";
|
||||
$proprietes_arr = get_object_vars($proprietes);
|
||||
// on obtient name, max_length, type, not_null, has_default, primary_key,
|
||||
// auto_increment et binary
|
||||
|
||||
// déclaration des variables correspondant aux champs
|
||||
// et reformatage des dates.
|
||||
|
||||
// on doit faire cette verif pour une enventuelle valeur "NULL"
|
||||
// non renvoyée -> ex: pas de societe membre
|
||||
// sinon on obtient un warning
|
||||
if (isset($result->fields[$proprietes_arr["name"]]))
|
||||
$val = $result->fields[$proprietes_arr["name"]];
|
||||
|
||||
if($proprietes_arr["type"]=="date" && $val!="")
|
||||
{
|
||||
list($a,$m,$j)=explode("-",$val);
|
||||
$val="$j/$m/$a";
|
||||
}
|
||||
$values[$proprietes_arr["name"]]=htmlentities(stripslashes(addslashes($val)), ENT_QUOTES);
|
||||
}
|
||||
reset($fields);
|
||||
}
|
||||
else
|
||||
{
|
||||
// initialisation des champs
|
||||
|
||||
}
|
||||
|
||||
// la date de creation de fiche, ici vide si nouvelle fiche
|
||||
if ($values['date_crea_adh']=="")
|
||||
$values['date_crea_adh'] = date("d/m/Y");
|
||||
if ($url_adh=="")
|
||||
$url_adh = "http://";
|
||||
if ($mdp_adh=="")
|
||||
$mdp_adh = makeRandomPassword();
|
||||
|
||||
// variable pour la desactivation de champs
|
||||
if ($_SESSION["admin_status"]==0)
|
||||
$disabled_field = "disabled";
|
||||
else
|
||||
$disabled_field = "";
|
||||
|
||||
|
||||
include("header.php");
|
||||
|
||||
?>
|
||||
|
||||
<H1 class="titre"><?php echo _T("Fiche adhérent"); ?> (<?php if ($id_adh!="") echo _T("modification"); else echo _T("création"); ?>)</H1>
|
||||
<FORM action="ajouter_adherent.php" method="post" enctype="multipart/form-data">
|
||||
|
||||
<?php
|
||||
// Affichage des erreurs
|
||||
if ($error_detected!="")
|
||||
{
|
||||
?>
|
||||
<DIV id="errorbox">
|
||||
<H1><?php echo _T("- ERREUR -"); ?></H1>
|
||||
<UL>
|
||||
<?php echo $error_detected; ?>
|
||||
</UL>
|
||||
</DIV>
|
||||
<?php
|
||||
}
|
||||
if ($warning_detected!="")
|
||||
{
|
||||
?>
|
||||
<DIV id="warningbox">
|
||||
<H1><?php echo _T("- AVERTISSEMENT -"); ?></H1>
|
||||
<UL>
|
||||
<?php echo $warning_detected; ?>
|
||||
</UL>
|
||||
</DIV>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<BLOCKQUOTE>
|
||||
<DIV align="center">
|
||||
<TABLE border="0" id="input-table">
|
||||
<TR>
|
||||
<TH <?php echo $titre_adh_req ?> id="libelle"><?php echo _T("Titre :"); ?></TH>
|
||||
<TD colspan="3">
|
||||
<INPUT type="radio" name="titre_adh" value="3"<?php isChecked($values['titre_adh'],"3") ?> <?php echo $disabled_field; ?>> <?php echo _T("Mademoiselle"); ?>
|
||||
<INPUT type="radio" name="titre_adh" value="2"<?php isChecked($values['titre_adh'],"2") ?> <?php echo $disabled_field; ?>> <?php echo _T("Madame"); ?>
|
||||
<INPUT type="radio" name="titre_adh" value="1"<?php isChecked($values['titre_adh'],"1") ?> <?php echo $disabled_field; ?>> <?php echo _T("Monsieur"); ?>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $nom_adh_req ?> id="libelle"><?php echo _T("Nom :"); ?></TH>
|
||||
<TD><INPUT type="text" name="nom_adh" value="<?php if(array_key_exists('nom_adh', $values)) echo $values['nom_adh']; ?>" maxlength="<?php echo $nom_adh_len; ?>" <?php echo $disabled_field; ?>></TD>
|
||||
<TD colspan="2" rowspan="5" align="center" width="130">
|
||||
<?php
|
||||
$image_adh = "";
|
||||
if (file_exists(WEB_ROOT . "photos/tn_" . $id_adh . ".jpg"))
|
||||
$image_adh = "photos/tn_" . $id_adh . ".jpg";
|
||||
elseif (file_exists(WEB_ROOT . "photos/tn_" . $id_adh . ".gif"))
|
||||
$image_adh = "photos/tn_" . $id_adh . ".gif";
|
||||
elseif (file_exists(WEB_ROOT . "photos/tn_" . $id_adh . ".png"))
|
||||
$image_adh = "photos/tn_" . $id_adh . ".png";
|
||||
elseif (file_exists(WEB_ROOT . "photos/" . $id_adh . ".jpg"))
|
||||
$image_adh = "photos/" . $id_adh . ".jpg";
|
||||
elseif (file_exists(WEB_ROOT . "photos/" . $id_adh . ".gif"))
|
||||
$image_adh = "photos/" . $id_adh . ".gif";
|
||||
elseif (file_exists(WEB_ROOT . "photos/" . $id_adh . ".png"))
|
||||
$image_adh = "photos/" . $id_adh . ".png";
|
||||
|
||||
if ($image_adh != "")
|
||||
{
|
||||
if (function_exists("ImageCreateFromString"))
|
||||
$imagedata = getimagesize($image_adh);
|
||||
else
|
||||
$imagedata = array("130","");
|
||||
?>
|
||||
<IMG src="<?php echo $image_adh."?nocache=".time(); ?>" border="1" alt="<?php echo _T("Photo"); ?>" width="<?php echo $imagedata[0]; ?>" height="<?php echo $imagedata[1]; ?>">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
echo _T("[ pas de photo ]");
|
||||
?>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $prenom_adh_req ?> id="libelle"><?php echo _T("Prénom :"); ?></TH>
|
||||
<TD><INPUT type="text" name="prenom_adh" value="<?php if(array_key_exists('prenom_adh', $values)) echo $values['prenom_adh']; ?>" maxlength="<?php echo $prenom_adh_len; ?>" <?php echo $disabled_field; ?>></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $pseudo_adh_req ?> id="libelle"><?php echo _T("Pseudo :"); ?></TH>
|
||||
<TD><INPUT type="text" name="pseudo_adh" value="<?php if(array_key_exists('pseudo_adh', $values)) echo $values['pseudo_adh']; ?>" maxlength="<?php echo $pseudo_adh_len; ?>"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $ddn_adh_req ?> id="libelle"><?php echo _T("Date de naissance :"); ?><br> </TH>
|
||||
<TD><INPUT type="text" name="ddn_adh" value="<?php if(array_key_exists('ddn_adh', $values)) echo $values['ddn_adh']; ?>" maxlength="10"><BR><DIV class="exemple"><?php echo _T("(format jj/mm/aaaa)"); ?></DIV></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $prof_adh_req ?> id="libelle"><?php echo _T("Profession :"); ?></TH>
|
||||
<TD><input type="text" name="prof_adh" value="<?php if(array_key_exists('prof_adh', $values)) echo $values['prof_adh']; ?>" maxlength="<?php echo $prof_adh_len; ?>"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle"><?php echo _T("Je souhaite apparaître dans la liste des membres :"); ?></TH>
|
||||
<TD><input type="checkbox" name="bool_display_info" value="1"<?php if(array_key_exists('bool_display_info', $values)) isChecked($values['bool_display_info'],"1") ?>></TD>
|
||||
<TH id="libelle"><?php echo _T("Photo :"); ?></TH>
|
||||
<TD>
|
||||
<?php
|
||||
if (file_exists(WEB_ROOT . "photos/" . $id_adh . ".jpg") ||
|
||||
file_exists(WEB_ROOT . "photos/" . $id_adh . ".png") ||
|
||||
file_exists(WEB_ROOT . "photos/" . $id_adh . ".gif"))
|
||||
{
|
||||
?>
|
||||
<INPUT type="submit" name="del_photo" value="<?php echo _T("Supprimer la photo"); ?>">
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<INPUT type="file" name="photo"><BR>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $panier_adh_req ?> id="libelle"><?php echo _T("Panier :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="panier_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="-1"<?php if(array_key_exists('panier_adh', $values)) isSelected($values['panier_adh'],"-1") ?>><?php echo "-"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('panier_adh', $values)) isSelected($values['panier_adh'],"1") ?>><?php echo _T("GP"); ?></OPTION>
|
||||
<OPTION value="0"<?php if(array_key_exists('panier_adh', $values)) isSelected($values['panier_adh'],"0") ?>><?php echo _T("pp"); ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TH <?php echo $pain_adh_req ?> id="libelle"><?php echo _T("Pain :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="pain_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('pain_adh', $values)) isSelected($values['pain_adh'],"0") ?>><?php echo "-"; ?></OPTION>
|
||||
<OPTION value="4"<?php if(array_key_exists('pain_adh', $values)) isSelected($values['pain_adh'],"4") ?>><?php echo _T("9¿50"); ?></OPTION>
|
||||
<OPTION value="3"<?php if(array_key_exists('pain_adh', $values)) isSelected($values['pain_adh'],"3") ?>><?php echo _T("7¿"); ?></OPTION>
|
||||
<OPTION value="2"<?php if(array_key_exists('pain_adh', $values)) isSelected($values['pain_adh'],"2") ?>><?php echo _T("5¿"); ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('pain_adh', $values)) isSelected($values['pain_adh'],"1") ?>><?php echo _T("3¿"); ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $volaille_adh_req ?> id="libelle"><?php echo _T("Volaille :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="volaille_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('volaille_adh', $values)) isSelected($values['volaille_adh'],"0") ?>><?php echo "non"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('volaille_adh', $values)) isSelected($values['volaille_adh'],"1") ?>><?php echo "oui"; ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TH <?php echo $boeuf_adh_req ?> id="libelle"><?php echo _T("Boeuf :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="boeuf_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('boeuf_adh', $values)) isSelected($values['boeuf_adh'],"0") ?>><?php echo "non"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('boeuf_adh', $values)) isSelected($values['boeuf_adh'],"1") ?>><?php echo "oui"; ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $veau_adh_req ?> id="libelle"><?php echo _T("Veau :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="veau_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('veau_adh', $values)) isSelected($values['veau_adh'],"0") ?>><?php echo "non"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('veau_adh', $values)) isSelected($values['veau_adh'],"1") ?>><?php echo "oui"; ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TH <?php echo $cochon_adh_req ?> id="libelle"><?php echo _T("Cochon :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="cochon_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('cochon_adh', $values)) isSelected($values['cochon_adh'],"0") ?>><?php echo "non"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('cochon_adh', $values)) isSelected($values['cochon_adh'],"1") ?>><?php echo "oui"; ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TR>
|
||||
<TR>
|
||||
<TH <?php echo $chevre_adh_req ?> id="libelle"><?php echo _T("Fromage de chèvre :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="chevre_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('chevre_adh', $values)) isSelected($values['chevre_adh'],"0") ?>><?php echo "non"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('chevre_adh', $values)) isSelected($values['chevre_adh'],"1") ?>><?php echo "oui"; ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TR>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<TR>
|
||||
<TH <?php echo $farine_adh_req ?> id="libelle"><?php echo _T("Farine-Huile :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="farine_adh" <?php echo $disabled_field; ?>>
|
||||
<OPTION value="0"<?php if(array_key_exists('farine_adh', $values)) isSelected($values['farine_adh'],"0") ?>><?php echo "non"; ?></OPTION>
|
||||
<OPTION value="1"<?php if(array_key_exists('farine_adh', $values)) isSelected($values['farine_adh'],"1") ?>><?php echo "oui"; ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TD>
|
||||
</TD>
|
||||
</TR>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]!=0)
|
||||
{
|
||||
?>
|
||||
<TR>
|
||||
<TH colspan="4" id="header"> </TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $activite_adh_req ?> id="libelle"><?php echo _T("Compte :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="activite_adh">
|
||||
<OPTION value="1"<?php if(array_key_exists('activite_adh', $values)) isSelected($values['activite_adh'],"1") ?>><?php echo _T("Actif"); ?></OPTION>
|
||||
<OPTION value="0"<?php if(array_key_exists('activite_adh', $values)) isSelected($values['activite_adh'],"0") ?>><?php echo _T("Inactif"); ?></OPTION>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TH id="header" colspan="2"> </TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH <?php echo $id_statut_req ?> id="libelle"><?php echo _T("Statut :"); ?></TH>
|
||||
<TD>
|
||||
<SELECT name="id_statut">
|
||||
<?php
|
||||
$requete = "SELECT *
|
||||
FROM ".PREFIX_DB."statuts
|
||||
ORDER BY priorite_statut";
|
||||
$result = $DB->Execute($requete);
|
||||
while (!$result->EOF)
|
||||
{
|
||||
?>
|
||||
<OPTION value="<?php echo $result->fields["id_statut"] ?>"<?php isSelected($id_statut,$result->fields["id_statut"]) ?>><?php echo _T($result->fields["libelle_statut"]); ?></OPTION>
|
||||
<?php
|
||||
$result->MoveNext();
|
||||
}
|
||||
$result->Close();
|
||||
?>
|
||||
</SELECT>
|
||||
</TD>
|
||||
<TH id="header" colspan="2"> </TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle"><?php echo _T("Admin Galette :"); ?></TH>
|
||||
<TD><input type="checkbox" name="bool_admin_adh" value="1"<?php if(array_key_exists('bool_admin_adh', $values)) isChecked($values['bool_admin_adh'],"1") ?>></TD>
|
||||
<TH id="header" colspan="2"> </TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle"><?php echo _T("Exempt de cotisation :"); ?></TH>
|
||||
<TD><INPUT type="checkbox" name="bool_exempt_adh" value="1"<?php if(array_key_exists('bool_exempt_adh', $values)) isChecked($values['bool_exempt_adh'],"1") ?>></TD>
|
||||
<TH id="header" colspan="2"> </TH>
|
||||
</TR>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<TR>
|
||||
<TH colspan="4" id="header"> </TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $adresse_adh_req ?>><?php echo _T("Adresse :"); ?></TH>
|
||||
<TD colspan="3">
|
||||
<INPUT type="text" name="adresse_adh" value="<?php if(array_key_exists('adresse_adh', $values)) echo $values['adresse_adh']; ?>" maxlength="<?php echo $adresse_adh_len; ?>" size="63"><BR>
|
||||
<INPUT type="text" name="adresse2_adh" value="<?php if(array_key_exists('adresse2_adh', $values)) echo $values['adresse2_adh']; ?>" maxlength="<?php echo $adresse2_adh_len; ?>" size="63">
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $cp_adh_req ?>><?php echo _T("Code Postal :"); ?></TH>
|
||||
<TD><INPUT type="text" name="cp_adh" value="<?php if(array_key_exists('cp_adh', $values)) echo $values['cp_adh']; ?>" maxlength="<?php echo $cp_adh_len; ?>"></TD>
|
||||
<TH id="libelle" <?php echo $ville_adh_req ?>><?php echo _T("Ville :"); ?></TH>
|
||||
<TD><INPUT type="text" name="ville_adh" value="<?php if(array_key_exists('ville_adh', $values)) echo $values['ville_adh']; ?>" maxlength="<?php echo $ville_adh_len; ?>"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $pays_adh_req ?>><?php echo _T("Pays :"); ?></TH>
|
||||
<TD><INPUT type="text" name="pays_adh" value="<?php if(array_key_exists('pays_adh', $values)) echo $values['pays_adh']; ?>" maxlength="<?php echo $pays_adh_len; ?>"></TD>
|
||||
<TH id="libelle" <?php echo $tel_adh_req ?>><?php echo _T("Tel :"); ?></TH>
|
||||
<TD><INPUT type="text" name="tel_adh" value="<?php if(array_key_exists('tel_adh', $values)) echo $values['tel_adh']; ?>" maxlength="<?php echo $tel_adh_len; ?>"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $gsm_adh_req ?>><?php echo _T("GSM :"); ?></TH>
|
||||
<TD><INPUT type="text" name="gsm_adh" value="<?php if(array_key_exists('gsm_adh', $values)) echo $values['gsm_adh']; ?>" maxlength="<?php echo $gsm_adh_len; ?>"></TD>
|
||||
<TH id="libelle" <?php echo $email_adh_req ?>><?php echo _T("E-Mail :"); ?></TH>
|
||||
<TD><INPUT type="text" name="email_adh" value="<?php if(array_key_exists('email_adh', $values)) echo $values['email_adh']; ?>" maxlength="<?php echo $email_adh_len; ?>" size="30"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $url_adh_req ?>><?php echo _T("Site Web :"); ?></TH>
|
||||
<TD><INPUT type="text" name="url_adh" value="<?php if(array_key_exists('url_adh', $values)) echo $values['url_adh']; ?>" maxlength="<?php echo $url_adh_len; ?>" size="30"></TD>
|
||||
<TH id="libelle" <?php echo $icq_adh_req ?>><?php echo _T("ICQ :"); ?></TH>
|
||||
<TD><INPUT type="text" name="icq_adh" value="<?php if(array_key_exists('icq_adh', $values)) echo $values['icq_adh']; ?>" maxlength="<?php echo $icq_adh_len; ?>"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $jabber_adh_req ?>><?php echo _T("Jabber :"); ?></TH>
|
||||
<TD><INPUT type="text" name="jabber_adh" value="<?php if(array_key_exists('jabber_adh', $values)) echo $values['jabber_adh']; ?>" maxlength="<?php echo $jabber_adh_len; ?>" size="30"></TD>
|
||||
<TH id="libelle" <?php echo $msn_adh_req ?>><?php echo _T("MSN :"); ?></TH>
|
||||
<TD><INPUT type="text" name="msn_adh" value="<?php if(array_key_exists('msn_adh', $values)) echo $values['msn_adh']; ?>" maxlength="<?php echo $msn_adh_len; ?>" size="30"></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH colspan="4" id="header"> </TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $login_adh_req ?>><?php echo _T("Identifiant :"); ?><BR> </TH>
|
||||
<TD><INPUT type="text" name="login_adh" value="<?php if(array_key_exists('login_adh', $values)) echo $values['login_adh']; ?>" maxlength="<?php echo $login_adh_len; ?>"><BR><DIV class="exemple"><?php echo _T("(au moins 4 caractères)"); ?></DIV></TD>
|
||||
<TH id="libelle" <?php echo $mdp_adh_req ?>><?php echo _T("Mot de passe :"); ?><BR> </TH>
|
||||
<TD><INPUT type="text" name="mdp_adh" value="<?php if(array_key_exists('mdp_adh', $values)) echo $values['mdp_adh']; ?>" maxlength="<?php echo $mdp_adh_len; ?>"><BR><DIV class="exemple"><?php echo _T("(au moins 4 caractères)"); ?></DIV></TD>
|
||||
</TR>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]!=0)
|
||||
{
|
||||
?>
|
||||
<TR>
|
||||
<TH id="libelle"><?php echo _T("Envoi de mail :"); ?><BR> </TH>
|
||||
<TD colspan="3"><INPUT type="checkbox" name="mail_confirm" value="1"><BR><DIV class="exemple"><?php echo _T("(l'adhérent recevra son identifiant et son mot de passe par mail, s'il a une adresse.)"); ?></DIV></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle"><?php echo _T("Date de création :"); ?><BR> </TH>
|
||||
<TD colspan="3"><INPUT type="text" name="date_crea_adh" value="<?php if(array_key_exists('date_crea_adh', $values)) echo $values['date_crea_adh']; ?>" maxlength="10"><BR><DIV class="exemple"><?php echo _T("(format jj/mm/aaaa)"); ?></DIV></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $info_adh_req ?>><?php echo _T("Autres informations (admin) :"); ?></TH>
|
||||
<TD colspan="3"><TEXTAREA name="info_adh" cols="61" rows="6"><?php if(array_key_exists('info_adh', $values)) echo $values['info_adh']; ?></TEXTAREA><BR><DIV class="exemple"><?php echo _T("Ce commentaire n'est visible que par les administrateurs."); ?></DIV></TD>
|
||||
</TR>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<TR>
|
||||
<TH id="libelle" <?php echo $info_public_adh_req ?>><?php echo _T("Autres informations :"); ?></TH>
|
||||
<TD colspan="3">
|
||||
<TEXTAREA name="info_public_adh" cols="61" rows="6"><?php if(array_key_exists('info_public_adh', $values)) echo $values['info_public_adh']; ?></TEXTAREA>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]!=0)
|
||||
{
|
||||
?>
|
||||
<BR><DIV class="exemple"><?php echo _T("Ce commentaire est réservé à l'adhérent."); ?></DIV>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH align="center" colspan="4"><BR><INPUT type="submit" name="valid" value="<?php echo _T("Enregistrer"); ?>"></TH>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</DIV>
|
||||
<BR>
|
||||
<?php echo _T("NB : Les champs obligatoires apparaissent en"); ?> <FONT style="color: #FF0000"><?php echo _T("rouge"); ?></FONT>.
|
||||
</BLOCKQUOTE>
|
||||
<INPUT type="hidden" name="id_adh" value="<?php echo $id_adh ?>">
|
||||
</FORM>
|
||||
<?php
|
||||
include("footer.php")
|
||||
?>
|
|
@ -1,392 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ajouter_contribution.php
|
||||
* - Saisie d'une contributions
|
||||
* Copyright (c) 2003 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
include("includes/config.inc.php");
|
||||
include(WEB_ROOT."includes/database.inc.php");
|
||||
include(WEB_ROOT."includes/functions.inc.php");
|
||||
include(WEB_ROOT."includes/lang.inc.php");
|
||||
include(WEB_ROOT."includes/session.inc.php");
|
||||
|
||||
if ($_SESSION["logged_status"]==0)
|
||||
{
|
||||
header("location: index.php");
|
||||
die();
|
||||
}
|
||||
if ($_SESSION["admin_status"]==0)
|
||||
{
|
||||
header("location: voir_adherent.php");
|
||||
die();
|
||||
}
|
||||
|
||||
// On vérifie si on a une référence => modif ou création
|
||||
$id_cotis = "";
|
||||
if (isset($_GET["id_cotis"]))
|
||||
if (is_numeric($_GET["id_cotis"]))
|
||||
$id_cotis = $_GET["id_cotis"];
|
||||
if (isset($_POST["id_cotis"]))
|
||||
if (is_numeric($_POST["id_cotis"]))
|
||||
$id_cotis = $_POST["id_cotis"];
|
||||
|
||||
// variables d'erreur (pour affichage)
|
||||
$error_detected = "";
|
||||
|
||||
//
|
||||
// DEBUT parametrage des champs
|
||||
// On recupere de la base la longueur et les flags des champs
|
||||
// et on initialise des valeurs par defaut
|
||||
|
||||
// recuperation de la liste de champs de la table
|
||||
$fields = $DB->MetaColumns(PREFIX_DB."cotisations");
|
||||
foreach ($fields as $champ => $proprietes)
|
||||
{
|
||||
$proprietes_arr = get_object_vars($proprietes);
|
||||
// on obtient name, max_length, type, not_null, has_default, primary_key,
|
||||
// auto_increment et binary
|
||||
|
||||
$fieldname = $proprietes_arr["name"];
|
||||
$fieldreq = $fieldname."_req";
|
||||
$fieldlen = $fieldname."_len";
|
||||
|
||||
// on ne met jamais a jour id_cotis -> on le saute
|
||||
if ($fieldname!="id_cotis")
|
||||
$$fieldname = "";
|
||||
|
||||
// definissons aussi la longueur des input text
|
||||
$max_tmp = $proprietes_arr["max_length"];
|
||||
if ($max_tmp == "-1")
|
||||
$max_tmp = 10;
|
||||
$$fieldlen = $max_tmp;
|
||||
|
||||
// et s'ils sont obligatoires (à partir de la base)
|
||||
if ($proprietes_arr["not_null"]==1)
|
||||
$$fieldreq = " style=\"color: #FF0000;\"";
|
||||
else
|
||||
$$fieldreq = "";
|
||||
}
|
||||
reset($fields);
|
||||
|
||||
// et les valeurs par defaut
|
||||
$id_type_cotis = "1";
|
||||
$duree_mois_cotis = "12";
|
||||
|
||||
//
|
||||
// FIN parametrage des champs
|
||||
//
|
||||
|
||||
$values = Array();
|
||||
$values['id_adh'] = "";
|
||||
if (isset($_GET["id_adh"]))
|
||||
$values['id_adh'] = $_GET["id_adh"];
|
||||
elseif (isset($_POST["id_adh"]))
|
||||
$values['id_adh'] = $_POST["id_adh"];
|
||||
if ($values['id_adh']!="")
|
||||
{
|
||||
$requete = "SELECT nom_adh, prenom_adh FROM ".PREFIX_DB."adherents WHERE id_adh=".$DB->qstr($values['id_adh']);
|
||||
$resultat = $DB->Execute($requete);
|
||||
if (!$resultat->EOF)
|
||||
{
|
||||
$nom_adh = $resultat->fields[0];
|
||||
$prenom_adh = $resultat->fields[1];
|
||||
$resultat->Close();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Validation du formulaire
|
||||
//
|
||||
|
||||
if (isset($_POST["valid"]))
|
||||
{
|
||||
// verification de champs
|
||||
$update_string = "";
|
||||
$insert_string_fields = "";
|
||||
$insert_string_values = "";
|
||||
|
||||
// recuperation de la liste de champs de la table
|
||||
//$fields = &$DB->MetaColumns(PREFIX_DB."cotisations");
|
||||
foreach ($fields as $champ => $proprietes)
|
||||
{
|
||||
$proprietes_arr = get_object_vars($proprietes);
|
||||
// on obtient name, max_length, type, not_null, has_default, primary_key,
|
||||
// auto_increment et binary
|
||||
|
||||
$fieldname = $proprietes_arr["name"];
|
||||
$fieldreq = $fieldname."_req";
|
||||
|
||||
// on ne met jamais a jour id_cotis -> on le saute
|
||||
if ($fieldname!="id_cotis")
|
||||
{
|
||||
if (isset($_POST[$fieldname]))
|
||||
$post_value=trim($_POST[$fieldname]);
|
||||
else
|
||||
$post_value="";
|
||||
|
||||
// on declare les variables pour la présaisie en cas d'erreur
|
||||
$$fieldname = htmlentities(stripslashes($post_value),ENT_QUOTES);
|
||||
|
||||
// vérification de la présence des champs obligatoires
|
||||
if ($$fieldreq!="" && $post_value=="")
|
||||
$error_detected = "<LI>"._T("- Vérifiez que tous les champs obligatoires sont renseignés.")."</LI>";
|
||||
else
|
||||
{
|
||||
$value = "";
|
||||
// validation des dates
|
||||
if($proprietes_arr["type"]=="date")
|
||||
{
|
||||
if (preg_match("/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/", $post_value, $array_jours))
|
||||
{
|
||||
if (checkdate($array_jours[2],$array_jours[1],$array_jours[3]))
|
||||
$value=$DB->DBDate(mktime(0,0,0,$array_jours[2],$array_jours[1],$array_jours[3]));
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Date non valide !")."</LI>";
|
||||
}
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Mauvais format de date (jj/mm/aaaa) !")."</LI>";
|
||||
}
|
||||
elseif(strstr($proprietes_arr["type"],"int"))
|
||||
{
|
||||
if (is_numeric($post_value) || $post_value=="")
|
||||
$value=$DB->qstr($post_value,ENT_QUOTES);
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- La durée doit être un entier !")."</LI>";
|
||||
}
|
||||
elseif(strstr($proprietes_arr["type"],"float"))
|
||||
{
|
||||
$us_value = strtr($post_value, ",", ".");
|
||||
if (is_numeric($us_value) || $us_value=="")
|
||||
$value=$DB->qstr($us_value,ENT_QUOTES);
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Le montant doit être un chiffre !")."</LI>";
|
||||
}
|
||||
else
|
||||
{
|
||||
// on se contente d'escaper le html et les caracteres speciaux
|
||||
$value = $DB->qstr($post_value,ENT_QUOTES);
|
||||
}
|
||||
|
||||
// mise à jour des chaines d'insertion/update
|
||||
$update_string .= ",".$fieldname."=".$value;
|
||||
$insert_string_fields .= ",".$fieldname;
|
||||
$insert_string_values .= ",".$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
reset($fields);
|
||||
|
||||
// modif ou ajout
|
||||
if ($error_detected=="")
|
||||
{
|
||||
if ($id_cotis!="")
|
||||
{
|
||||
// modif
|
||||
|
||||
$requete = "UPDATE ".PREFIX_DB."cotisations
|
||||
SET " . substr($update_string,1) . "
|
||||
WHERE id_cotis=" . $DB->qstr($id_cotis);
|
||||
dblog(_T("Mise à jour d'une contribution :")." ".strtoupper($nom_adh)." ".$prenom_adh, $requete);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ajout
|
||||
|
||||
$requete = "INSERT INTO ".PREFIX_DB."cotisations
|
||||
(" . substr($insert_string_fields,1) . ")
|
||||
VALUES (" . substr($insert_string_values,1) . ")";
|
||||
|
||||
dblog(_T("Ajout d'une contribution :")." ".strtoupper($nom_adh)." ".$prenom_adh, $requete);
|
||||
}
|
||||
$DB->Execute("SET NAMES utf8");
|
||||
$DB->Execute($requete);
|
||||
$DB->Execute("SET NAMES latin1");
|
||||
|
||||
// mise a jour de l'échéance
|
||||
$date_fin = get_echeance($DB, $values['id_adh']);
|
||||
if ($date_fin!="")
|
||||
$date_fin_update = $DB->DBDate(mktime(0,0,0,$date_fin[1],$date_fin[0],$date_fin[2]));
|
||||
else
|
||||
$date_fin_update = "'NULL'";
|
||||
|
||||
$requete = "UPDATE ".PREFIX_DB."adherents
|
||||
SET date_echeance=".$date_fin_update."
|
||||
WHERE id_adh='".$values['id_adh']."'";
|
||||
$DB->Execute($requete);
|
||||
|
||||
// retour à la liste
|
||||
header("location: gestion_contributions.php?id_adh=".$values['id_adh']);
|
||||
|
||||
// récupération du max pour passage en mode modif apres insertion
|
||||
if ($id_cotis=="")
|
||||
{
|
||||
$requete = "SELECT max(id_cotis)
|
||||
AS max
|
||||
FROM ".PREFIX_DB."cotisations";
|
||||
$max = $DB->Execute($requete);
|
||||
$id_cotis = $max->fields["max"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Pré-remplissage des champs
|
||||
// avec des valeurs issues de la base
|
||||
// -> donc uniquement si l'enregistrement existe et que le formulaire
|
||||
// n'a pas déja été posté avec des erreurs (pour pouvoir corriger)
|
||||
|
||||
if (!isset($_POST["valid"]) || (isset($_POST["valid"]) && $error_detected==""))
|
||||
if ($id_cotis != "")
|
||||
{
|
||||
// recup des données
|
||||
$requete = "SELECT *
|
||||
FROM ".PREFIX_DB."cotisations
|
||||
WHERE id_cotis=$id_cotis";
|
||||
$result = $DB->Execute($requete);
|
||||
if ($result->EOF)
|
||||
header("location: index.php");
|
||||
|
||||
|
||||
|
||||
// recuperation de la liste de champs de la table
|
||||
//$fields = &$DB->MetaColumns(PREFIX_DB."cotisations");
|
||||
foreach ($fields as $champ => $proprietes)
|
||||
{
|
||||
$proprietes_arr = get_object_vars($proprietes);
|
||||
// on obtient name, max_length, type, not_null, has_default, primary_key,
|
||||
// auto_increment et binary
|
||||
|
||||
// déclaration des variables correspondant aux champs
|
||||
// et reformatage des dates.
|
||||
|
||||
$val = $result->fields[$proprietes_arr["name"]];
|
||||
|
||||
if($proprietes_arr["type"]=="date" && $val!="")
|
||||
{
|
||||
list($a,$m,$j)=explode("-",$val);
|
||||
$val="$j/$m/$a";
|
||||
}
|
||||
$values[$proprietes_arr["name"]] = htmlentities(stripslashes(addslashes($val)), ENT_QUOTES);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// initialisation des champs
|
||||
|
||||
}
|
||||
|
||||
// la date de creation de fiche, ici vide si nouvelle fiche
|
||||
if ($date_cotis=="")
|
||||
$date_cotis = date("d/m/Y");
|
||||
|
||||
include("header.php");
|
||||
|
||||
?>
|
||||
|
||||
<H1 class="titre"><?php echo _T("Fiche contribution"); ?> (<?php if ($id_cotis!="") echo _T("modification"); else echo _T("création"); ?>)</H1>
|
||||
<FORM action="ajouter_contribution.php" method="post">
|
||||
|
||||
<?php
|
||||
// Affichage des erreurs
|
||||
if ($error_detected!="")
|
||||
{
|
||||
?>
|
||||
<DIV id="errorbox">
|
||||
<H1><?php echo _T("- ERREUR -"); ?></H1>
|
||||
<UL>
|
||||
<?php echo $error_detected; ?>
|
||||
</UL>
|
||||
</DIV>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<BLOCKQUOTE>
|
||||
<div align="center">
|
||||
<table border="0" id="input-table">
|
||||
<tr>
|
||||
<TH id="libelle" <?php echo $id_adh_req ?>><?php echo _T("Contributeur :"); ?></TH>
|
||||
<td>
|
||||
<select name="id_adh">
|
||||
<option value="" <?php isSelected($values['id_adh'],"") ?>><?php echo _T("-- selectionner un nom --"); ?></option>
|
||||
<?php
|
||||
$requete = "SELECT id_adh, nom_adh, prenom_adh
|
||||
FROM ".PREFIX_DB."adherents
|
||||
ORDER BY nom_adh, prenom_adh";
|
||||
$result = $DB->Execute($requete);
|
||||
while (!$result->EOF)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $result->fields[0] ?>"<?php isSelected($values['id_adh'],$result->fields[0]) ?>><?php echo htmlentities(strtoupper($result->fields[1]), ENT_QUOTES)." ".htmlentities($result->fields[2], ENT_QUOTES); ?></option>
|
||||
<?php
|
||||
$result->MoveNext();
|
||||
}
|
||||
$result->Close();
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<TH id="libelle" <?php echo $id_type_cotis_req ?>><?php echo _T("Type de contribution :"); ?></TH>
|
||||
<td>
|
||||
<select name="id_type_cotis">
|
||||
<?php
|
||||
$requete = "SELECT id_type_cotis, libelle_type_cotis
|
||||
FROM ".PREFIX_DB."types_cotisation
|
||||
ORDER BY libelle_type_cotis";
|
||||
$result = $DB->Execute($requete);
|
||||
while (!$result->EOF)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $result->fields["id_type_cotis"] ?>"<?php isSelected($id_type_cotis,$result->fields["id_type_cotis"]) ?>><?php echo _T($result->fields["libelle_type_cotis"]) ?></option>
|
||||
<?php
|
||||
$result->MoveNext();
|
||||
}
|
||||
$result->Close();
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<TH id="libelle" <?php echo $montant_cotis_req ?>><?php echo _T("Montant :"); ?></TH>
|
||||
<td><input type="text" name="montant_cotis" value="<?php if(array_key_exists('montant_cotis', $values)) echo $values['montant_cotis']; ?>" maxlength="<?php echo $montant_cotis_len; ?>"></td>
|
||||
<TH id="libelle" <?php echo $duree_mois_cotis_req ?>><?php echo _T("Prolongation adhésion :"); ?></TH>
|
||||
<td><input type="text" name="duree_mois_cotis" value="<?php if(array_key_exists('duree_mois_cotis', $values)) echo $values['duree_mois_cotis']; ?>" maxlength="<?php echo $duree_mois_cotis_len; ?>"> <?php echo _T("mois"); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<TH id="libelle" <?php echo $date_cotis_req ?>><?php echo _T("Date contribution :"); ?><br> </TH>
|
||||
<td colspan="3"><input type="text" name="date_cotis" value="<?php if(array_key_exists('date_cotis', $values)) echo $values['date_cotis']; ?>" maxlength="10"><BR><DIV class="exemple"><?php echo _T("(format jj/mm/aaaa)"); ?></DIV></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<TH id="libelle" <?php echo $info_cotis_req ?>><?php echo _T("Commentaire :"); ?></TH>
|
||||
<td colspan="3"><textarea name="info_cotis" cols="61" rows="6"><?php if(array_key_exists('info_cotis', $values)) echo $values['info_cotis']; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<TH align="center" colspan="4"><BR><input type="submit" name="valid" value="<?php echo _T("Enregistrer"); ?>"></TH>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<?php echo _T("NB : Les champs obligatoires apparaissent en"); ?> <font style="color: #FF0000"><?php echo _T("rouge"); ?></font>.
|
||||
</BLOCKQUOTE>
|
||||
<input type="hidden" name="id_cotis" value="<?php echo $id_cotis ?>">
|
||||
</form>
|
||||
<?php
|
||||
// }
|
||||
|
||||
|
||||
include("footer.php")
|
||||
?>
|
|
@ -1,208 +0,0 @@
|
|||
<?php
|
||||
/* etiquettes_adherents.php
|
||||
* - Generation d'un PDF d'étiquettes
|
||||
* Copyright (c) 2003 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
include("includes/config.inc.php");
|
||||
include(WEB_ROOT."includes/database.inc.php");
|
||||
include(WEB_ROOT."includes/functions.inc.php");
|
||||
include(WEB_ROOT."includes/lang.inc.php");
|
||||
include(WEB_ROOT."includes/session.inc.php");
|
||||
include(WEB_ROOT."includes/phppdflib/phppdflib.class.php");
|
||||
|
||||
if ($_SESSION["logged_status"]==0)
|
||||
die();
|
||||
if ($_SESSION["admin_status"]==0)
|
||||
die();
|
||||
$mailing_adh = array();
|
||||
if (isset($_POST["mailing_adh"]))
|
||||
{
|
||||
while (list($key,$value)=each($_POST["mailing_adh"]))
|
||||
$mailing_adh[]=$value;
|
||||
}
|
||||
else
|
||||
die();
|
||||
$requete = "SELECT id_adh, nom_adh, prenom_adh, adresse_adh,
|
||||
titre_adh, cp_adh, ville_adh, pays_adh, adresse2_adh, panier_adh, pain_adh
|
||||
FROM ".PREFIX_DB."adherents
|
||||
WHERE ";
|
||||
$where_clause = "";
|
||||
if ( ! isset($_POST['mois']))
|
||||
$mois=date("m");
|
||||
else
|
||||
$mois=$_POST['mois'];
|
||||
$annee=date("Y");
|
||||
if ($mois == "13")
|
||||
{
|
||||
$mois="01";
|
||||
$annee=$annee+1;
|
||||
}
|
||||
$datenow=$annee . "-" . $mois . "-0";
|
||||
while(list($key,$value)=each($mailing_adh))
|
||||
{
|
||||
if ($where_clause!="")
|
||||
$where_clause .= " OR ";
|
||||
$where_clause .= "id_adh=".$DB->qstr($value);
|
||||
}
|
||||
$requete .= $where_clause." ORDER by nom_adh, prenom_adh;";
|
||||
$resultat = &$DB->Execute($requete);
|
||||
|
||||
$pdf = new pdffile;
|
||||
$pdf->set_default('margin', 0);
|
||||
$firstpage = $pdf->new_page("a4-landscape");
|
||||
$param["height"] = PREF_ETIQ_CORPS;
|
||||
$param["fillcolor"] = $pdf->get_color('#000000');
|
||||
$param["align"] = "center";
|
||||
$param["width"] = 1;
|
||||
$param["strokecolor"] = $pdf->get_color('#000000');
|
||||
if ($resultat->EOF)
|
||||
die();
|
||||
$yorigin=545;
|
||||
$xorigin=round(PREF_ETIQ_MARGES*2.835);
|
||||
$row=1;
|
||||
$nb_etiq=0;
|
||||
$concatname = "";
|
||||
$i=0;
|
||||
$j=0;
|
||||
while (date("Ym",strtotime("$j saturday", strtotime($datenow))) <= $annee.$mois)
|
||||
{
|
||||
$j++;
|
||||
if (date("m",strtotime("$j saturday", strtotime($datenow))) == $mois) {
|
||||
$panier[$i][0]=0;
|
||||
$panier[$i][1]=0;
|
||||
$date[$i]=date("d/m/Y",strtotime($j . " saturday", strtotime($datenow)));
|
||||
$date2[$i]=date("Y-m-d",strtotime($j . " saturday", strtotime($datenow)));
|
||||
$i++;
|
||||
}
|
||||
if ($j > 10) {
|
||||
print "Problème dans le calcul des mois !";
|
||||
die();
|
||||
}
|
||||
}
|
||||
$col = $i;
|
||||
$ligne = 18;
|
||||
$x1 = 70;
|
||||
$x2 = 300;
|
||||
$ecart = 480/$col;
|
||||
$hecart = 490/$ligne;
|
||||
|
||||
|
||||
while (!$resultat->EOF)
|
||||
{
|
||||
$y1 = $yorigin-(($row-1)*($hecart));
|
||||
$y2 = $y1 - $hecart;
|
||||
if ($row==1)
|
||||
{
|
||||
$param["font"] = "Helvetica-Bold";
|
||||
$pdf->draw_rectangle($yorigin+20, $x1, $yorigin, $x2, $firstpage, $param);
|
||||
$pdf->draw_paragraph($yorigin+20, $x1, $yorigin, $x2, "Nom", $firstpage, $param);
|
||||
$pdf->draw_rectangle($yorigin+20, $x2, $yorigin, $x2+40, $firstpage, $param);
|
||||
$pdf->draw_paragraph($yorigin+20, $x2, $yorigin, $x2+40, "Prix", $firstpage, $param);
|
||||
$i=0;
|
||||
while($i<$col)
|
||||
{
|
||||
$xdr1=$x2+40+$i*$ecart;
|
||||
$xdr2=$x2+40+($i+1)*$ecart;
|
||||
$pdf->draw_paragraph($yorigin+20, $xdr1, $yorigin, $xdr2, $date[$i], $firstpage, $param);
|
||||
$pdf->draw_rectangle($yorigin+20, $xdr1, $yorigin, $xdr2, $firstpage, $param);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if ( ($_POST['panier'] == "legume" && $resultat->fields[9] != "-1") || ($_POST['panier'] == "pain" && $resultat->fields[10] != "0") ) {
|
||||
$nom_adh_ext="";
|
||||
switch($resultat->fields[4])
|
||||
{
|
||||
case "1" :
|
||||
$nom_adh_ext .= _T("M.");
|
||||
break;
|
||||
case "2" :
|
||||
$nom_adh_ext .= _T("Mme.");
|
||||
break;
|
||||
default :
|
||||
$nom_adh_ext .= _T("Mlle.");
|
||||
}
|
||||
|
||||
$nom_adh_ext .= " ".strtoupper($resultat->fields[1])." ".ucfirst(strtolower($resultat->fields[2]));
|
||||
$concatname = $concatname . " - " . $nom_adh_ext;
|
||||
$param["font"] = "Helvetica";
|
||||
$pdf->draw_paragraph($y1-5, $x1, $y2, $x2, $nom_adh_ext, $firstpage, $param);
|
||||
$pdf->draw_rectangle ($y1, $x1, $y2, $x2, $firstpage, $param);
|
||||
$pdf->draw_rectangle($y1, $x2, $y2, $x2+40, $firstpage, $param);
|
||||
// $pdf->draw_rectangle($y1, $x2+20, $y2, $x2+40, $firstpage, $param);
|
||||
if ($_POST['panier'] == "legume")
|
||||
{
|
||||
$qpanier=$resultat->fields[9];
|
||||
if ($qpanier == "0" )
|
||||
$qpanier_result="pp";
|
||||
else
|
||||
$qpanier_result="GP";
|
||||
} else if ($_POST['panier'] == "pain") {
|
||||
$qpanier=$resultat->fields[10];
|
||||
if ($qpanier == "1" )
|
||||
$qpanier_result="3";
|
||||
if ($qpanier == "2" )
|
||||
$qpanier_result="5";
|
||||
if ($qpanier == "3" )
|
||||
$qpanier_result="7";
|
||||
if ($qpanier == "4" )
|
||||
$qpanier_result="9,50";
|
||||
}
|
||||
$pdf->draw_paragraph($y1, $x2, $y2, $x2+40, $qpanier_result, $firstpage, $param);
|
||||
$i=0;
|
||||
while($i<$col)
|
||||
{
|
||||
$absence = &$DB->Execute("SELECT * FROM `galette_absences` WHERE `id_adh` = " . $resultat->fields[0] . " AND `date_abs` = '$date2[$i]'");
|
||||
if (!$absence->EOF)
|
||||
$pdf->draw_paragraph($y1, $x2+$i*$ecart+40, $y2, $x2+($i+1)*$ecart+40, "Absent", $firstpage, $param);
|
||||
else
|
||||
$panier[$i+1][$qpanier]=$panier[$i+1][$qpanier]+1;
|
||||
$pdf->draw_rectangle($y1, $x2+$i*$ecart+40, $y2, $x2+($i+1)*$ecart+40, $firstpage, $param);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$row++;
|
||||
if ($row>$ligne)
|
||||
{
|
||||
$row=1;
|
||||
$firstpage = $pdf->new_page("a4-landscape");
|
||||
}
|
||||
$nb_etiq++;
|
||||
}
|
||||
$resultat->MoveNext();
|
||||
}
|
||||
$i=0;
|
||||
while($i<$col)
|
||||
{
|
||||
$pdf->draw_rectangle($y2, $x2+$i*$ecart+40, $y2-20, $x2+($i+1)*$ecart+40, $firstpage, $param);
|
||||
if ($_POST['panier'] == "legume")
|
||||
$display="pp : " . $panier[$i+1][0] . " | GP : " . $panier[$i+1][1];
|
||||
if ($_POST['panier'] == "pain")
|
||||
$display="3E : " . $panier[$i+1][1] . " | 5E : " . $panier[$i+1][2] . " | 7E : " . $panier[$i+1][3] . " | 9E50 : " . $panier[$i+1][4];
|
||||
|
||||
$pdf->draw_paragraph($y2, $x2+$i*$ecart+40, $y2-20, $x2+($i+1)*$ecart+40, $display, $firstpage, $param);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$resultat->Close();
|
||||
dblog(_T("Génération de ")." ".$nb_etiq." "._T("feuille emargement"),$concatname);
|
||||
header("Content-Disposition: filename=feuille_emargement.pdf");
|
||||
header("Content-Type: application/pdf");
|
||||
$temp = $pdf->generate();
|
||||
header('Content-Length: ' . strlen($temp));
|
||||
echo $temp;
|
||||
?>
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
/* etiquettes_adherents.php
|
||||
* - Generation d'un PDF d'étiquettes
|
||||
* Copyright (c) 2003 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
include("includes/config.inc.php");
|
||||
include(WEB_ROOT."includes/database.inc.php");
|
||||
include(WEB_ROOT."includes/functions.inc.php");
|
||||
include(WEB_ROOT."includes/lang.inc.php");
|
||||
include(WEB_ROOT."includes/session.inc.php");
|
||||
include(WEB_ROOT."includes/phppdflib/phppdflib.class.php");
|
||||
|
||||
if ($_SESSION["logged_status"]==0)
|
||||
die();
|
||||
if ($_SESSION["admin_status"]==0)
|
||||
die();
|
||||
|
||||
$mailing_adh = array();
|
||||
if (isset($_POST["mailing_adh"]))
|
||||
{
|
||||
while (list($key,$value)=each($_POST["mailing_adh"]))
|
||||
$mailing_adh[]=$value;
|
||||
}
|
||||
else
|
||||
die();
|
||||
|
||||
$requete = "SELECT id_adh, nom_adh, prenom_adh, adresse_adh,
|
||||
titre_adh, cp_adh, ville_adh, pays_adh, adresse2_adh
|
||||
FROM ".PREFIX_DB."adherents
|
||||
WHERE ";
|
||||
$where_clause = "";
|
||||
while(list($key,$value)=each($mailing_adh))
|
||||
{
|
||||
if ($where_clause!="")
|
||||
$where_clause .= " OR ";
|
||||
$where_clause .= "id_adh=".$DB->qstr($value);
|
||||
}
|
||||
$requete .= $where_clause." ORDER by nom_adh, prenom_adh;";
|
||||
// echo $requete;
|
||||
$resultat = &$DB->Execute($requete);
|
||||
|
||||
$pdf = new pdffile;
|
||||
$pdf->set_default('margin', 0);
|
||||
$firstpage = $pdf->new_page("a4");
|
||||
$param["height"] = PREF_ETIQ_CORPS;
|
||||
$param["fillcolor"] = $pdf->get_color('#000000');
|
||||
$param["align"] = "center";
|
||||
$param["width"] = 1;
|
||||
$param["strokecolor"] = $pdf->get_color('#DDDDDD');
|
||||
|
||||
if ($resultat->EOF)
|
||||
die();
|
||||
|
||||
$yorigin=842-round(PREF_ETIQ_MARGES*2.835);
|
||||
$xorigin=round(PREF_ETIQ_MARGES*2.835);
|
||||
$col=1;
|
||||
$row=1;
|
||||
$nb_etiq=0;
|
||||
$concatname = "";
|
||||
while (!$resultat->EOF)
|
||||
{
|
||||
$nom_adh_ext="";
|
||||
switch($resultat->fields[4])
|
||||
{
|
||||
case "1" :
|
||||
$nom_adh_ext .= _T("M.");
|
||||
break;
|
||||
case "2" :
|
||||
$nom_adh_ext .= _T("Mme.");
|
||||
break;
|
||||
default :
|
||||
$nom_adh_ext .= _T("Mlle.");
|
||||
}
|
||||
|
||||
$x1 = $xorigin + ($col-1)*(round(PREF_ETIQ_HSIZE*2.835)+round(PREF_ETIQ_HSPACE*2.835));
|
||||
$x2 = $x1 + round(PREF_ETIQ_HSIZE*2.835);
|
||||
$y1 = $yorigin-($row-1)*(round(PREF_ETIQ_VSIZE*2.835)+round(PREF_ETIQ_VSPACE*2.835));
|
||||
$y2 = $y1 - round(PREF_ETIQ_VSIZE*2.835);
|
||||
|
||||
$nom_adh_ext .= " ".strtoupper($resultat->fields[1])." ".ucfirst(strtolower($resultat->fields[2]));
|
||||
$concatname = $concatname . " - " . $nom_adh_ext;
|
||||
$param["font"] = "Helvetica-Bold";
|
||||
$pdf->draw_paragraph($y1-10, $x1, $y1-10-(round(PREF_ETIQ_VSIZE*2.835)/5)+5, $x2, $nom_adh_ext, $firstpage, $param);
|
||||
$param["font"] = "Helvetica";
|
||||
$pdf->draw_paragraph ($y1-10-(round(PREF_ETIQ_VSIZE*2.835)/5), $x1, $y1-10-(round(PREF_ETIQ_VSIZE*2.835)/5)-(round(PREF_ETIQ_VSIZE*2.835)*4/5), $x2, $resultat->fields[3]."\n".$resultat->fields[8]."\n".$resultat->fields[5]." - ".$resultat->fields[6]."\n".$resultat->fields[7], $firstpage, $param);
|
||||
$pdf->draw_rectangle ($y1, $x1, $y2, $x2, $firstpage, $param);
|
||||
$resultat->MoveNext();
|
||||
|
||||
$col++;
|
||||
if ($col>PREF_ETIQ_COLS)
|
||||
{
|
||||
$col=1;
|
||||
$row++;
|
||||
}
|
||||
if ($row>PREF_ETIQ_ROWS)
|
||||
{
|
||||
$col=1;
|
||||
$row=1;
|
||||
$firstpage = $pdf->new_page("a4");
|
||||
}
|
||||
$nb_etiq++;
|
||||
}
|
||||
$resultat->Close();
|
||||
dblog(_T("Génération de ")." ".$nb_etiq." "._T("étiquette(s)"),$concatname);
|
||||
|
||||
header("Content-Disposition: filename=example.pdf");
|
||||
header("Content-Type: application/pdf");
|
||||
$temp = $pdf->generate();
|
||||
header('Content-Length: ' . strlen($temp));
|
||||
echo $temp;
|
||||
?>
|
|
@ -1,168 +0,0 @@
|
|||
<?php
|
||||
/* footer.php
|
||||
* - Pied de page
|
||||
* Copyright (c) 2003 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
$end = utime(); $run = $end - $start;
|
||||
?>
|
||||
<DIV id="copyright">
|
||||
<A href="http://www.zopeuse.org/projets/galette/Wiki_galette/FrontPage">Galette <?php echo GALETTE_VERSION ?></A> - <?php echo _T("Réalisation :"); ?> <A href="mailto:deelight@logeek.com">Deelight</A> - <?php echo _T("Graphisme :"); ?> <A href="http://www.gimp.org">Gimp</A> - <?php echo _T("Editeur :"); ?> <A href="http://bluefish.openoffice.nl">Bluefish</A> - <?php echo _T("Page affichée en")." ".substr($run, 0, 5)." "._T("secondes."); ?>
|
||||
</DIV>
|
||||
</DIV>
|
||||
<DIV id="menu">
|
||||
<DIV id="logo">
|
||||
<IMG src="images/galette.jpg" alt="[ Galette ]" width="103" height="80"><BR>
|
||||
Galette
|
||||
</DIV>
|
||||
<DIV id="nav1">
|
||||
<H1><?php echo _T("Navigation"); ?></H1>
|
||||
<UL>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<LI><A href="gestion_adherents.php"><?php echo _T("Liste des adhérents"); ?></A></LI>
|
||||
<LI><A href="gestion_contributions.php"><?php echo _T("Liste des contributions"); ?></A></LI>
|
||||
<LI><A href="ajouter_adherent.php"><?php echo _T("Ajouter un adhérent"); ?></A></LI>
|
||||
<LI><A href="ajouter_contribution.php"><?php echo _T("Ajouter une contribution"); ?></A></LI>
|
||||
<LI><A href="log.php"><?php echo _T("Historique"); ?></A></LI>
|
||||
<LI><A href="preferences.php"><?php echo _T("Préférences"); ?></A></LI>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<LI><A href="voir_adherent.php"><?php echo _T("Mes informations"); ?></A></LI>
|
||||
<LI><A href="gestion_contributions.php"><?php echo _T("Mes contributions"); ?></A></LI>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</UL>
|
||||
</DIV>
|
||||
<DIV id="logout">
|
||||
<A href="index.php?logout=1"><?php echo _T("Déconnexion"); ?></A>
|
||||
</DIV>
|
||||
<?php
|
||||
if (basename($_SERVER["SCRIPT_NAME"])=="gestion_adherents.php" || basename($_SERVER["SCRIPT_NAME"])=="mailing_adherents.php")
|
||||
{
|
||||
?>
|
||||
<DIV id="legende">
|
||||
<H1><?php echo _T("Légende"); ?></H1>
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-male.png" Alt="<?php echo _T("[H]"); ?>" align="middle" width="10" height="12"></TD>
|
||||
<TD class="back"><?php echo _T("Homme"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-female.png" Alt="<?php echo _T("[F]"); ?>" align="middle" width="9" height="12"></TD>
|
||||
<TD class="back"><?php echo _T("Femme"); ?></TD>
|
||||
</TR>
|
||||
<?php
|
||||
if (basename($_SERVER["SCRIPT_NAME"])=="gestion_adherents.php")
|
||||
{
|
||||
?>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-mail.png" Alt="<?php echo _T("[Mail]"); ?>" align="middle" border="0" width="14" height="10"></TD>
|
||||
<TD class="back"><?php echo _T("Envoyer un mail"); ?></TD>
|
||||
</TR>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-star.png" Alt="<?php echo _T("[admin]"); ?>" align="middle" width="12" height="13"></TD>
|
||||
<TD class="back"><?php echo _T("Administrateur"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-edit.png" alt="<?php echo _T("[mod]"); ?>" border="0" width="12" height="13"></TD>
|
||||
<TD class="back"><?php echo _T("Modification"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-money.png" alt="<?php echo _T("[$]"); ?>" border="0" width="13" height="13"></TD>
|
||||
<TD class="back"><?php echo _T("Contributions"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-trash.png" alt="<?php echo _T("[sup]"); ?>" border="0" width="11" height="13"></TD>
|
||||
<TD class="back"><?php echo _T("Suppression"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="back"><?php echo _T("Nom"); ?></TD>
|
||||
<TD class="back"><?php echo _T("Compte actif"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="inactif back"><?php echo _T("Nom"); ?></TD>
|
||||
<TD class="back"><?php echo _T("Compte désactivé"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="cotis-never color-sample"> </TD>
|
||||
<TD class="back"><?php echo _T("N'a jamais cotisé"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="cotis-ok color-sample"> </TD>
|
||||
<TD class="back"><?php echo _T("Adhésion en règle"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="cotis-soon color-sample"> </TD>
|
||||
<TD class="back"><?php echo _T("Adhésion à échéance (<30j)"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="cotis-late color-sample"> </TD>
|
||||
<TD class="back"><?php echo _T("Retard de cotisation"); ?></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</DIV>
|
||||
<?php
|
||||
}
|
||||
elseif (basename($_SERVER["SCRIPT_NAME"])=="gestion_contributions.php")
|
||||
{
|
||||
?>
|
||||
<DIV id="legende">
|
||||
<H1><?php echo _T("Légende"); ?></H1>
|
||||
<TABLE>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-edit.png" alt="<?php echo _T("[mod]"); ?>" border="0" width="12" height="13"></TD>
|
||||
<TD class="back"><?php echo _T("Modification"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="back"><IMG src="images/icon-trash.png" alt="<?php echo _T("[sup]"); ?>" border="0" width="11" height="13"></TD>
|
||||
<TD class="back"><?php echo _T("Suppression"); ?></TD>
|
||||
</TR>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<TR>
|
||||
<TD width="30" class="cotis-normal color-sample"> </TD>
|
||||
<TD class="back"><?php echo _T("Cotisation"); ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="30" class="cotis-give color-sample"> </TD>
|
||||
<TD class="back"><?php echo _T("Don"); ?></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</DIV>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,414 +0,0 @@
|
|||
body {
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
margin-bottom: 0px;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 11px
|
||||
}
|
||||
|
||||
input {
|
||||
font-size: 11px
|
||||
}
|
||||
|
||||
select {
|
||||
font-size: 11px
|
||||
}
|
||||
|
||||
textarea {
|
||||
font-size: 11px
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cotis-ok {
|
||||
background-color: #DDFFDD;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-never {
|
||||
background-color: #EEEEEE;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-exempt {
|
||||
background-color: #DDFFDD;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-soon {
|
||||
background-color: #FFE9AB;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-late {
|
||||
background-color: #FFDDDD;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-lastday {
|
||||
background-color: #FFDDDD;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-normal {
|
||||
background-color: #DDFFDD;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.cotis-give {
|
||||
background-color: #FFDDDD;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.totalcount {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.pageswitch {
|
||||
text-align: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.pagelink {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.filtermenus {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.titre {
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
background-color: #FBFBFB;
|
||||
border-color: #BBBBBB;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
color: #000000;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th.listing {
|
||||
font-size: 10px;
|
||||
background-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
a.listing {
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.listing:hover {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.emptylist {
|
||||
background-color: #EEEEEE;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.actif {
|
||||
}
|
||||
|
||||
.inactif {
|
||||
color: #777777;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.acronyme {
|
||||
color: #AAAAAA;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#copyright {
|
||||
color: #CCCCCC;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
padding-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#copyright a {
|
||||
color: #CCCCCC;
|
||||
}
|
||||
|
||||
#copyright a:hover {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.exemple {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
width: 150px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
#nav1 {
|
||||
width: 150px;
|
||||
margin-left: 5px;
|
||||
border-color: #7777FF;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#nav1 h1 {
|
||||
margin: 2px;
|
||||
font-size: 10px;
|
||||
background-color: #DDDDFF;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
#nav1 ul {
|
||||
list-style-type: none;
|
||||
margin: 2px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#nav1 li {
|
||||
background-color: #EEEEEE;
|
||||
margin-bottom: 2px;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
#logout {
|
||||
width: 150px;
|
||||
margin-left: 5px;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#legende {
|
||||
width: 150px;
|
||||
margin-left: 5px;
|
||||
margin-bottom: 5px;
|
||||
border-color: #7777FF;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#legende table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#legende h1 {
|
||||
margin: 2px;
|
||||
font-size: 10px;
|
||||
background-color: #DDDDFF;
|
||||
padding-left: 2px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#legende td {
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
#legende .back {
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
.color-sample {
|
||||
border-color: #AAAAAA;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#content {
|
||||
position: absolute;
|
||||
padding-right: 15px;
|
||||
left: 170px;
|
||||
}
|
||||
|
||||
#menu {
|
||||
float: left;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#listfilter {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#listfilter form {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
#infoline {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#infoline2 {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
#mailing_preview {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
margin-left: 30px;;
|
||||
margin-right: 30px;
|
||||
border-color: #DDDDDD;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#mailing_preview th {
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
#errorbox {
|
||||
color: #FF0000;
|
||||
border-color: #FFDDDD;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#errorbox h1 {
|
||||
background-color: #FFDDDD;
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
#errorbox ul {
|
||||
list-style-type: none;
|
||||
margin: 2px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#warningbox {
|
||||
color: #000000;
|
||||
border-color: #FFE8CC;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#warningbox h1 {
|
||||
background-color: #FFE8CC;
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
#warningbox ul {
|
||||
list-style-type: none;
|
||||
margin: 2px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#input-table #libelle {
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
background-color: #DDDDFF;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#input-table #header {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#input-table td {
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
#installpage {
|
||||
background-color: #DDDDFF;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#installpage p {
|
||||
background-color: #DDDDFF;
|
||||
padding-left: 20px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#installpage h1 {
|
||||
text-align: left;
|
||||
margin: 0px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#installpage #submitbutton2 {
|
||||
text-align: center;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#installpage #submitbutton3 {
|
||||
text-align: right;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.titreinstall {
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
background-color: #FBFBFB;
|
||||
border-color: #BBBBBB;
|
||||
color: #000000;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
padding: 10px 0px 10px 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.footerinstall {
|
||||
font-size: 11px;
|
||||
text-align: right;
|
||||
padding-right: 20px;
|
||||
font-weight: normal;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
background-color: #FBFBFB;
|
||||
border-color: #BBBBBB;
|
||||
color: #000000;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
margin: 0px;
|
||||
}
|
|
@ -1,449 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* gestion_adherents.php
|
||||
* - Récapitulatif des adhérents
|
||||
* Copyright (c) 2003 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
include("includes/config.inc.php");
|
||||
include(WEB_ROOT."includes/database.inc.php");
|
||||
include(WEB_ROOT."includes/functions.inc.php");
|
||||
include(WEB_ROOT."includes/lang.inc.php");
|
||||
include(WEB_ROOT."includes/session.inc.php");
|
||||
|
||||
if ($_SESSION["logged_status"]==0)
|
||||
{
|
||||
header("location: index.php");
|
||||
die();
|
||||
}
|
||||
if ($_SESSION["admin_status"]==0)
|
||||
{
|
||||
header("location: voir_adherent.php");
|
||||
die();
|
||||
}
|
||||
|
||||
$page = 1;
|
||||
if (isset($_GET["page"]))
|
||||
$page = $_GET["page"];
|
||||
|
||||
if (isset($_GET["filtre"]))
|
||||
if (is_numeric($_GET["filtre"]))
|
||||
$_SESSION["filtre_adh"]=$_GET["filtre"];
|
||||
if (! isset($_SESSION["filtre_adh"]))
|
||||
$_SESSION["filtre_adh"]='';
|
||||
|
||||
if (isset($_GET["filtre_adh_2"]))
|
||||
if (is_numeric($_GET["filtre_2"]))
|
||||
$_SESSION["filtre_adh_2"]=$_GET["filtre_2"];
|
||||
if (! isset($_SESSION["filtre_adh_2"]))
|
||||
$_SESSION["filtre_adh_2"]='';
|
||||
if (isset($_GET["filtre_3"]))
|
||||
if (is_numeric($_GET["filtre_3"]))
|
||||
$_SESSION["filtre_adh_3"]=$_GET["filtre_3"];
|
||||
if (! isset($_SESSION["filtre_adh_3"]))
|
||||
$_SESSION["filtre_adh_3"]='';
|
||||
|
||||
// Tri
|
||||
|
||||
if (isset($_GET["tri"]))
|
||||
if (is_numeric($_GET["tri"]))
|
||||
{
|
||||
if ($_SESSION["tri_adh"]==$_GET["tri"])
|
||||
$_SESSION["tri_adh_sens"]=($_SESSION["tri_adh_sens"]+1)%2;
|
||||
else
|
||||
{
|
||||
$_SESSION["tri_adh"]=$_GET["tri"];
|
||||
$_SESSION["tri_adh_sens"]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include("header.php");
|
||||
|
||||
if (isset($_GET["sup"]))
|
||||
{
|
||||
if (is_numeric($_GET["sup"]))
|
||||
{
|
||||
$requetesup = "SELECT nom_adh, prenom_adh FROM ".PREFIX_DB."adherents WHERE id_adh=".$DB->qstr($_GET["sup"]);
|
||||
$resultat = $DB->Execute($requetesup);
|
||||
if (!$resultat->EOF)
|
||||
{
|
||||
// supression record adhérent
|
||||
$requetesup = "DELETE FROM ".PREFIX_DB."adherents
|
||||
WHERE id_adh=".$DB->qstr($_GET["sup"]);
|
||||
$DB->Execute($requetesup);
|
||||
|
||||
// suppression de l'eventuelle photo
|
||||
@unlink(WEB_ROOT . "photos/".$id_adh.".jpg");
|
||||
@unlink(WEB_ROOT . "photos/".$id_adh.".gif");
|
||||
@unlink(WEB_ROOT . "photos/".$id_adh.".jpg");
|
||||
@unlink(WEB_ROOT . "photos/tn_".$id_adh.".jpg");
|
||||
@unlink(WEB_ROOT . "photos/tn_".$id_adh.".gif");
|
||||
@unlink(WEB_ROOT . "photos/tn_".$id_adh.".jpg");
|
||||
|
||||
// suppression records cotisations
|
||||
$requetesup = "DELETE FROM ".PREFIX_DB."cotisations
|
||||
WHERE id_adh=" . $DB->qstr($_GET["sup"]);
|
||||
$DB->Execute($requetesup);
|
||||
dblog(_T("Suppression de la fiche adhérent (et cotisations) :")." ".strtoupper($resultat->fields[0])." ".$resultat->fields[1], $requetesup);
|
||||
}
|
||||
$resultat->Close();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<H1 class="titre"><?php echo _T("Gestion des adhérents"); ?></H1>
|
||||
<?php
|
||||
// selection des adherents et application filtre / tri
|
||||
|
||||
$requete[0] = "SELECT id_adh, nom_adh, prenom_adh, pseudo_adh, activite_adh,
|
||||
libelle_statut, bool_exempt_adh, titre_adh, email_adh, bool_admin_adh, date_echeance
|
||||
FROM ".PREFIX_DB."adherents, ".PREFIX_DB."statuts
|
||||
WHERE ".PREFIX_DB."adherents.id_statut=".PREFIX_DB."statuts.id_statut ";
|
||||
$requete[1] = "SELECT count(id_adh)
|
||||
FROM ".PREFIX_DB."adherents
|
||||
WHERE 1=1 ";
|
||||
|
||||
// filtre d'affichage des adherents activés/desactivés
|
||||
if ($_SESSION["filtre_adh_2"]=="1")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.activite_adh='1' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.activite_adh='1' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_2"]=="2")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.activite_adh='0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.activite_adh='0' ";
|
||||
}
|
||||
// filtre par panier
|
||||
if ($_SESSION["filtre_adh_3"]=="1")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.panier_adh != '-1' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.panier_adh != '-1' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="2")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.pain_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.pain_adh != '0' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="3")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.volaille_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.volaille_adh != '0' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="4")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.boeuf_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.boeuf_adh != '0' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="5")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.veau_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.veau_adh != '0' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="6")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.cochon_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.cochon_adh != '0' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="7")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.farine_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.farine_adh != '0' ";
|
||||
}
|
||||
elseif ($_SESSION["filtre_adh_3"]=="8")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."adherents.chevre_adh != '0' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."adherents.chevre_adh != '0' ";
|
||||
}
|
||||
// filtre d'affichage des adherents retardataires
|
||||
if ($_SESSION["filtre_adh"]=="2")
|
||||
{
|
||||
$requete[0] .= "AND date_echeance < ".$DB->DBDate(time())." ";
|
||||
$requete[1] .= "AND date_echeance < ".$DB->DBDate(time())." ";
|
||||
}
|
||||
|
||||
// filtre d'affichage des adherents à jour
|
||||
if ($_SESSION["filtre_adh"]=="3")
|
||||
{
|
||||
$requete[0] .= "AND (date_echeance > ".$DB->DBDate(time())." OR bool_exempt_adh='1') ";
|
||||
$requete[1] .= "AND (date_echeance > ".$DB->DBDate(time())." OR bool_exempt_adh='1') ";
|
||||
}
|
||||
|
||||
// filtre d'affichage des adherents bientot a echeance
|
||||
if ($_SESSION["filtre_adh"]=="1")
|
||||
{
|
||||
$requete[0] .= "AND date_echeance > ".$DB->DBDate(time())."
|
||||
AND date_echeance < ".$DB->OffsetDate(30)." ";
|
||||
$requete[1] .= "AND date_echeance > ".$DB->DBDate(time())."
|
||||
AND date_echeance < ".$DB->OffsetDate(30)." ";
|
||||
}
|
||||
|
||||
// phase de tri
|
||||
|
||||
if ($_SESSION["tri_adh_sens"]=="0")
|
||||
$tri_adh_sens_txt="ASC";
|
||||
else
|
||||
$tri_adh_sens_txt="DESC";
|
||||
|
||||
$requete[0] .= "ORDER BY ";
|
||||
|
||||
// tri par pseudo
|
||||
if ($_SESSION["tri_adh"]=="1")
|
||||
$requete[0] .= "pseudo_adh ".$tri_adh_sens_txt.",";
|
||||
|
||||
// tri par statut
|
||||
elseif ($_SESSION["tri_adh"]=="2")
|
||||
$requete[0] .= "priorite_statut ".$tri_adh_sens_txt.",";
|
||||
|
||||
// tri par echeance
|
||||
elseif ($_SESSION["tri_adh"]=="3")
|
||||
$requete[0] .= "bool_exempt_adh ".$tri_adh_sens_txt.", date_echeance ".$tri_adh_sens_txt.",";
|
||||
|
||||
// defaut : tri par nom, prenom
|
||||
$requete[0] .= "nom_adh ".$tri_adh_sens_txt.", prenom_adh ".$tri_adh_sens_txt;
|
||||
$resultat = $DB->SelectLimit($requete[0],PREF_NUMROWS,($page-1)*PREF_NUMROWS);
|
||||
$nbadh = $DB->Execute($requete[1]);
|
||||
|
||||
if ($nbadh->fields[0]%PREF_NUMROWS==0)
|
||||
$nbpages = intval($nbadh->fields[0]/PREF_NUMROWS);
|
||||
else
|
||||
$nbpages = intval($nbadh->fields[0]/PREF_NUMROWS)+1;
|
||||
$pagestring = "";
|
||||
if ($nbpages==0)
|
||||
$pagestring = "<b>1</b>";
|
||||
else for ($i=1;$i<=$nbpages;$i++)
|
||||
{
|
||||
if ($i!=$page)
|
||||
$pagestring .= "<A href=\"gestion_adherents.php?page=".$i."\">".$i."</A> ";
|
||||
else
|
||||
$pagestring .= $i." ";
|
||||
}
|
||||
?>
|
||||
<DIV id="listfilter">
|
||||
<FORM action="gestion_adherents.php" method="get" name="filtre">
|
||||
<?php echo _T("Afficher :"); ?>
|
||||
<SELECT name="filtre" onChange="form.submit()">
|
||||
<OPTION value="0"<?php isSelected("0",$_SESSION["filtre_adh"]) ?>><?php echo _T("Tous les adhérents"); ?></OPTION>
|
||||
<OPTION value="3"<?php isSelected("3",$_SESSION["filtre_adh"]) ?>><?php echo _T("Les adhérents à jour"); ?></OPTION>
|
||||
<OPTION value="1"<?php isSelected("1",$_SESSION["filtre_adh"]) ?>><?php echo _T("Les échéances proches"); ?></OPTION>
|
||||
<OPTION value="2"<?php isSelected("2",$_SESSION["filtre_adh"]) ?>><?php echo _T("Les retardataires"); ?></OPTION>
|
||||
</SELECT>
|
||||
<SELECT name="filtre_2" onChange="form.submit()">
|
||||
<OPTION value="0"<?php isSelected("0",$_SESSION["filtre_adh_2"]) ?>><?php echo _T("Tous les comptes"); ?></OPTION>
|
||||
<OPTION value="1"<?php isSelected("1",$_SESSION["filtre_adh_2"]) ?>><?php echo _T("Comptes actifs"); ?></OPTION>
|
||||
<OPTION value="2"<?php isSelected("2",$_SESSION["filtre_adh_2"]) ?>><?php echo _T("Comptes désactivés"); ?></OPTION>
|
||||
</SELECT>
|
||||
<SELECT name="filtre_3" onChange="form.submit()">
|
||||
<OPTION value="0"<?php isSelected("0",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Tous les paniers"); ?></OPTION>
|
||||
<OPTION value="1"<?php isSelected("1",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Legumes"); ?></OPTION>
|
||||
<OPTION value="2"<?php isSelected("2",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Pain"); ?></OPTION>
|
||||
<OPTION value="3"<?php isSelected("3",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Volaille"); ?></OPTION>
|
||||
<OPTION value="4"<?php isSelected("4",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Boeuf"); ?></OPTION>
|
||||
<OPTION value="5"<?php isSelected("4",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Veau"); ?></OPTION>
|
||||
<OPTION value="6"<?php isSelected("4",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Cochon"); ?></OPTION>
|
||||
<OPTION value="7"<?php isSelected("5",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Farine-Huile"); ?></OPTION>
|
||||
<OPTION value="8"<?php isSelected("6",$_SESSION["filtre_adh_3"]) ?>><?php echo _T("Fromage de chèvre"); ?></OPTION>
|
||||
</SELECT>
|
||||
<INPUT type="submit" value="<?php echo _T("Filtrer"); ?>">
|
||||
</FORM>
|
||||
</DIV>
|
||||
<TABLE id="infoline" width="100%">
|
||||
<TR>
|
||||
<TD class="left"><?php echo $nbadh->fields[0]." "; if ($nbadh->fields[0]!=1) echo _T("adhérents"); else echo _T("adhérent"); ?></TD>
|
||||
<TD class="right"><?php echo _T("Pages :"); ?> <SPAN class="pagelink"><?php echo $pagestring; ?></SPAN></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<TABLE width="100%">
|
||||
<TR>
|
||||
<TH width="15" class="listing">#</TH>
|
||||
<TH width="250" class="listing left">
|
||||
<A href="gestion_adherents.php?tri=0" class="listing"><?php echo _T("Nom"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_adh"]=="0")
|
||||
{
|
||||
if ($_SESSION["tri_adh_sens"]=="0")
|
||||
$img_sens = "asc.png";
|
||||
else
|
||||
$img_sens = "desc.png";
|
||||
}
|
||||
else
|
||||
$img_sens = "icon-empty.png";
|
||||
?>
|
||||
<IMG src="images/<?php echo $img_sens; ?>" width="7" height="7" alt="">
|
||||
</TH>
|
||||
<TH class="listing left" nowrap>
|
||||
<A href="gestion_adherents.php?tri=1" class="listing"><?php echo _T("Pseudo"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_adh"]=="1")
|
||||
{
|
||||
if ($_SESSION["tri_adh_sens"]=="0")
|
||||
$img_sens = "asc.png";
|
||||
else
|
||||
$img_sens = "desc.png";
|
||||
}
|
||||
else
|
||||
$img_sens = "icon-empty.png";
|
||||
?>
|
||||
<IMG src="images/<?php echo $img_sens; ?>" width="7" height="7" alt="">
|
||||
</TH>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_adherents.php?tri=2" class="listing"><?php echo _T("Statut"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_adh"]=="2")
|
||||
{
|
||||
if ($_SESSION["tri_adh_sens"]=="0")
|
||||
$img_sens = "asc.png";
|
||||
else
|
||||
$img_sens = "desc.png";
|
||||
}
|
||||
else
|
||||
$img_sens = "icon-empty.png";
|
||||
?>
|
||||
<IMG src="images/<?php echo $img_sens; ?>" width="7" height="7" alt="">
|
||||
</TH>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_adherents.php?tri=3" class="listing"><?php echo _T("Etat cotisations"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_adh"]=="3")
|
||||
{
|
||||
if ($_SESSION["tri_adh_sens"]=="0")
|
||||
$img_sens = "asc.png";
|
||||
else
|
||||
$img_sens = "desc.png";
|
||||
}
|
||||
else
|
||||
$img_sens = "icon-empty.png";
|
||||
?>
|
||||
<IMG src="images/<?php echo $img_sens; ?>" width="7" height="7" alt="">
|
||||
</TH>
|
||||
<TH width="55" class="listing"><?php echo _T("Actions"); ?></TH>
|
||||
</TR>
|
||||
<?php
|
||||
$compteur = 1+($page-1)*PREF_NUMROWS;
|
||||
if ($resultat->EOF)
|
||||
{
|
||||
?>
|
||||
<TR><TD colspan="6" class="emptylist"><?php echo _T("aucun adhérent"); ?></TD></TR>
|
||||
<?php
|
||||
}
|
||||
else while (!$resultat->EOF)
|
||||
{
|
||||
// définition CSS pour adherent désactivé
|
||||
if ($resultat->fields[4]=="1")
|
||||
$row_class = "actif";
|
||||
else
|
||||
$row_class = "inactif";
|
||||
|
||||
// temps d'adhésion
|
||||
if($resultat->fields[6])
|
||||
{
|
||||
$statut_cotis = _T("Exempt de cotisation");
|
||||
$row_class .= " cotis-exempt";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($resultat->fields[10]=="")
|
||||
{
|
||||
$statut_cotis = _T("N'a jamais cotisé");
|
||||
$row_class .= " cotis-never";
|
||||
}
|
||||
else
|
||||
{
|
||||
$date_fin = preg_split("~-~",$resultat->fields[10]);
|
||||
$ts_date_fin = mktime(0,0,0,$date_fin[1],$date_fin[2],$date_fin[0]);
|
||||
$aujourdhui = time();
|
||||
|
||||
$difference = intval(($ts_date_fin - $aujourdhui)/(3600*24));
|
||||
if ($difference==0)
|
||||
{
|
||||
$statut_cotis = _T("Dernier jour !");
|
||||
$row_class .= " cotis-lastday";
|
||||
}
|
||||
elseif ($difference<0)
|
||||
{
|
||||
$statut_cotis = _T("En retard de ").-$difference." "._T("jours")." ("._T("depuis le")." ".$date_fin[2]."/".$date_fin[1]."/".$date_fin[0].")";
|
||||
$row_class .= " cotis-late";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($difference!=1)
|
||||
$statut_cotis = $difference." "._T("jours restants")." ("._T("fin le")." ".$date_fin[2]."/".$date_fin[1]."/".$date_fin[0].")";
|
||||
else
|
||||
$statut_cotis = $difference." "._T("jour restant")." ("._T("fin le")." ".$date_fin[2]."/".$date_fin[1]."/".$date_fin[0].")";
|
||||
if ($difference < 30)
|
||||
$row_class .= " cotis-soon";
|
||||
else
|
||||
$row_class .= " cotis-ok";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<TR>
|
||||
<TD width="15" class="<?php echo $row_class ?>"><?php echo $compteur ?></TD>
|
||||
<TD class="<?php echo $row_class ?>" nowrap>
|
||||
<?php
|
||||
if ($resultat->fields[7]=="1") {
|
||||
?>
|
||||
<IMG src="images/icon-male.png" Alt="<?php echo _T("[H]"); ?>" align="middle" width="10" height="12">
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<IMG src="images/icon-female.png" Alt="<?php echo _T("[F]"); ?>" align="middle" width="9" height="12">
|
||||
<?php
|
||||
}
|
||||
if ($resultat->fields[8]!="") {
|
||||
?>
|
||||
<A href="mailto:<?php echo $resultat->fields[8] ?>"><IMG src="images/icon-mail.png" Alt="<?php echo _T("[Mail]"); ?>" align="middle" border="0" width="14" height="10"></A>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<IMG src="images/icon-empty.png" Alt="" align="middle" border="0" width="14" height="10">
|
||||
<?php
|
||||
}
|
||||
if ($resultat->fields[9]=="1") {
|
||||
?>
|
||||
<IMG src="images/icon-star.png" Alt="<?php echo _T("[admin]"); ?>" align="middle" width="12" height="13">
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<IMG src="images/icon-empty.png" Alt="" align="middle" width="12" height="13">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<A href="voir_adherent.php?id_adh=<?php echo $resultat->fields["id_adh"] ?>"><?php echo htmlentities(strtoupper($resultat->fields[1]),ENT_QUOTES)." ".htmlentities($resultat->fields[2], ENT_QUOTES) ?></A>
|
||||
</TD>
|
||||
<TD class="<?php echo $row_class ?>" nowrap><?php echo htmlentities($resultat->fields[3], ENT_QUOTES) ?></TD>
|
||||
<TD class="<?php echo $row_class ?>" nowrap><?php echo _T($resultat->fields[5]) ?></TD>
|
||||
<TD class="<?php echo $row_class ?>" nowrap><?php echo $statut_cotis ?></TD>
|
||||
<TD class="<?php echo $row_class ?> center">
|
||||
<A href="ajouter_adherent.php?id_adh=<?php echo $resultat->fields[0] ?>"><IMG src="images/icon-edit.png" alt="<?php echo _T("[mod]"); ?>" border="0" width="12" height="13"></A>
|
||||
<A href="gestion_contributions.php?id_adh=<?php echo $resultat->fields[0] ?>"><IMG src="images/icon-money.png" alt="<?php echo _T("[$]"); ?>" border="0" width="13" height="13"></A>
|
||||
<A onClick="return confirm('<?php echo str_replace("\n","\\n",addslashes(_T("Voulez-vous vraiment supprimer cet adhérent de la base, ceci supprimera aussi l'historique de ses cotisations. Pour éviter cela vous pouvez simplement désactiver le compte.\n\nVoulez-vous tout de même supprimer cet adhérent ?"))); ?>')" href="gestion_adherents.php?sup=<?php echo $resultat->fields[0] ?>"><IMG src="images/icon-trash.png" alt="<?php echo _T("[sup]"); ?>" border="0" width="11" height="13"></A>
|
||||
</TD>
|
||||
</TR>
|
||||
<?php
|
||||
$compteur++;
|
||||
$resultat->MoveNext();
|
||||
}
|
||||
$resultat->Close();
|
||||
?>
|
||||
</TABLE>
|
||||
<DIV id="infoline2" class="right"><?php echo _T("Pages :"); ?> <SPAN class="pagelink"><?php echo $pagestring; ?></SPAN></DIV>
|
||||
<?php
|
||||
include("footer.php");
|
||||
?>
|
|
@ -1,465 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* gestion_contributions.php
|
||||
* - Récapitulatif des contributions
|
||||
* Copyright (c) 2004 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
include("includes/config.inc.php");
|
||||
include(WEB_ROOT."includes/database.inc.php");
|
||||
include(WEB_ROOT."includes/functions.inc.php");
|
||||
include(WEB_ROOT."includes/lang.inc.php");
|
||||
include(WEB_ROOT."includes/session.inc.php");
|
||||
|
||||
$filtre_id_adh = "";
|
||||
|
||||
if ($_SESSION["logged_status"]==0)
|
||||
{
|
||||
header("location: index.php");
|
||||
die();
|
||||
}
|
||||
if ($_SESSION["admin_status"]==0)
|
||||
$_SESSION["filtre_cotis_adh"] = $_SESSION["logged_id_adh"];
|
||||
else
|
||||
{
|
||||
if (isset($_GET["id_adh"]))
|
||||
{
|
||||
if (is_numeric($_GET["id_adh"]))
|
||||
$_SESSION["filtre_cotis_adh"]=$_GET["id_adh"];
|
||||
else
|
||||
$_SESSION["filtre_cotis_adh"]="";
|
||||
}
|
||||
else
|
||||
$_SESSION["filtre_cotis_adh"]="";
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET["contrib_filter_1"]))
|
||||
if (ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $_GET["contrib_filter_1"], $array_jours))
|
||||
{
|
||||
if (checkdate($array_jours[2],$array_jours[1],$array_jours[3]))
|
||||
$_SESSION["filtre_date_cotis_1"]=$_GET["contrib_filter_1"];
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Date non valide !")."</LI>";
|
||||
}
|
||||
elseif (ereg("^([0-9]{4})$", $_GET["contrib_filter_1"], $array_jours))
|
||||
$_SESSION["filtre_date_cotis_1"]="01/01/".$array_jours[1];
|
||||
elseif ($_GET["contrib_filter_1"]=="")
|
||||
$_SESSION["filtre_date_cotis_1"]="";
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Mauvais format de date (jj/mm/aaaa) !")."</LI>";
|
||||
|
||||
if (isset($_GET["contrib_filter_2"]))
|
||||
if (ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $_GET["contrib_filter_2"], $array_jours))
|
||||
{
|
||||
if (checkdate($array_jours[2],$array_jours[1],$array_jours[3]))
|
||||
$_SESSION["filtre_date_cotis_2"]=$_GET["contrib_filter_2"];
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Date non valide !")."</LI>";
|
||||
}
|
||||
elseif (ereg("^([0-9]{4})$", $_GET["contrib_filter_2"], $array_jours))
|
||||
$_SESSION["filtre_date_cotis_2"]="01/01/".$array_jours[1];
|
||||
elseif ($_GET["contrib_filter_2"]=="")
|
||||
$_SESSION["filtre_date_cotis_2"]="";
|
||||
else
|
||||
$error_detected .= "<LI>"._T("- Mauvais format de date (jj/mm/aaaa) !")."</LI>";
|
||||
|
||||
|
||||
$page = 1;
|
||||
if (isset($_GET["page"]))
|
||||
$page = $_GET["page"];
|
||||
|
||||
|
||||
// Tri
|
||||
|
||||
if (isset($_GET["tri"]))
|
||||
{
|
||||
if ($_SESSION["tri_cotis"]==$_GET["tri"])
|
||||
$_SESSION["tri_cotis_sens"]=($_SESSION["tri_cotis_sens"]+1)%2;
|
||||
else
|
||||
{
|
||||
$_SESSION["tri_cotis"]=$_GET["tri"];
|
||||
$_SESSION["tri_cotis_sens"]=0;
|
||||
}
|
||||
}
|
||||
|
||||
include("header.php");
|
||||
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
if (isset($_GET["sup"]))
|
||||
{
|
||||
// recherche adherent
|
||||
$requetesel = "SELECT id_adh
|
||||
FROM ".PREFIX_DB."cotisations
|
||||
WHERE id_cotis=".$DB->qstr($_GET["sup"]);
|
||||
$result_adh = $DB->Execute($requetesel);
|
||||
if (!$result_adh->EOF)
|
||||
{
|
||||
$id_adh = $result_adh->fields["id_adh"];
|
||||
|
||||
$requetesup = "SELECT nom_adh, prenom_adh FROM ".PREFIX_DB."adherents WHERE id_adh=".$DB->qstr($id_adh);
|
||||
$resultat = $DB->Execute($requetesup);
|
||||
if (!$resultat->EOF)
|
||||
{
|
||||
// supression record cotisation
|
||||
$requetesup = "DELETE FROM ".PREFIX_DB."cotisations
|
||||
WHERE id_cotis=".$DB->qstr($_GET["sup"]);
|
||||
$DB->Execute($requetesup);
|
||||
|
||||
// mise a jour de l'échéance
|
||||
$date_fin = get_echeance($DB, $id_adh);
|
||||
if ($date_fin!="")
|
||||
$date_fin_update = $DB->DBDate(mktime(0,0,0,$date_fin[1],$date_fin[0],$date_fin[2]));
|
||||
else
|
||||
$date_fin_update = "NULL";
|
||||
$requeteup = "UPDATE ".PREFIX_DB."adherents
|
||||
SET date_echeance=".$date_fin_update."
|
||||
WHERE id_adh=".$DB->qstr($id_adh);
|
||||
$DB->Execute("SET NAMES utf8");
|
||||
$DB->Execute($requeteup);
|
||||
$DB->Execute("SET NAMES latin1");
|
||||
dblog(_T("Suppression d'une contribution :")." ".strtoupper($resultat->fields[0])." ".$resultat->fields[1], $requetesup);
|
||||
}
|
||||
$resultat->Close();
|
||||
}
|
||||
$result_adh->Close();
|
||||
}
|
||||
?>
|
||||
<H1 class="titre"><?php echo _T("Gestion des contributions"); ?></H1>
|
||||
<?php
|
||||
$requete[0] = "SELECT ".PREFIX_DB."cotisations.*, ".PREFIX_DB."adherents.nom_adh, ".PREFIX_DB."adherents.prenom_adh,
|
||||
".PREFIX_DB."types_cotisation.libelle_type_cotis
|
||||
FROM ".PREFIX_DB."cotisations,".PREFIX_DB."adherents,".PREFIX_DB."types_cotisation
|
||||
WHERE ".PREFIX_DB."cotisations.id_adh=".PREFIX_DB."adherents.id_adh
|
||||
AND ".PREFIX_DB."types_cotisation.id_type_cotis=".PREFIX_DB."cotisations.id_type_cotis ";
|
||||
$requete[1] = "SELECT count(id_cotis)
|
||||
FROM ".PREFIX_DB."cotisations
|
||||
WHERE 1=1 ";
|
||||
|
||||
// phase filtre
|
||||
|
||||
if ($_SESSION["filtre_cotis_adh"]!="")
|
||||
{
|
||||
$requete[0] .= "AND ".PREFIX_DB."cotisations.id_adh='" . $_SESSION["filtre_cotis_adh"] . "' ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."cotisations.id_adh='" . $_SESSION["filtre_cotis_adh"] . "' ";
|
||||
}
|
||||
|
||||
// date filter
|
||||
if ($_SESSION["filtre_date_cotis_1"]!="")
|
||||
{
|
||||
ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $_SESSION["filtre_date_cotis_1"], $array_jours);
|
||||
$datemin = $DB->DBDate(mktime(0,0,0,$array_jours[2],$array_jours[1],$array_jours[3]));
|
||||
$requete[0] .= "AND ".PREFIX_DB."cotisations.date_cotis >= " . $datemin . " ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."cotisations.date_cotis >= " . $datemin . " ";
|
||||
}
|
||||
if ($_SESSION["filtre_date_cotis_2"]!="")
|
||||
{
|
||||
ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $_SESSION["filtre_date_cotis_2"], $array_jours);
|
||||
$datemax = $DB->DBDate(mktime(0,0,0,$array_jours[2],$array_jours[1],$array_jours[3]));
|
||||
$requete[0] .= "AND ".PREFIX_DB."cotisations.date_cotis <= " . $datemax . " ";
|
||||
$requete[1] .= "AND ".PREFIX_DB."cotisations.date_cotis <= " . $datemax . " ";
|
||||
}
|
||||
|
||||
// phase de tri
|
||||
|
||||
if ($_SESSION["tri_cotis_sens"]=="0")
|
||||
$tri_cotis_sens_txt="ASC";
|
||||
else
|
||||
$tri_cotis_sens_txt="DESC";
|
||||
|
||||
$requete[0] .= "ORDER BY ";
|
||||
|
||||
// tri par adherent
|
||||
if ($_SESSION["tri_cotis"]=="1")
|
||||
$requete[0] .= "nom_adh ".$tri_cotis_sens_txt.", prenom_adh ".$tri_cotis_sens_txt.",";
|
||||
|
||||
// tri par type
|
||||
elseif ($_SESSION["tri_cotis"]=="2")
|
||||
$requete[0] .= "libelle_type_cotis ".$tri_cotis_sens_txt.",";
|
||||
|
||||
// tri par montant
|
||||
elseif ($_SESSION["tri_cotis"]=="3")
|
||||
$requete[0] .= "montant_cotis ".$tri_cotis_sens_txt.",";
|
||||
|
||||
// tri par duree
|
||||
elseif ($_SESSION["tri_cotis"]=="4")
|
||||
$requete[0] .= "duree_mois_cotis ".$tri_cotis_sens_txt.",";
|
||||
|
||||
// defaut : tri par date
|
||||
$requete[0] .= " ".PREFIX_DB."cotisations.date_cotis ".$tri_cotis_sens_txt;
|
||||
|
||||
// $resultat = &$DB->Execute($requete[0]);
|
||||
$resultat = $DB->SelectLimit($requete[0],PREF_NUMROWS,($page-1)*PREF_NUMROWS);
|
||||
$nbcotis = $DB->Execute($requete[1]);
|
||||
|
||||
if ($nbcotis->fields[0]%PREF_NUMROWS==0)
|
||||
$nbpages = intval($nbcotis->fields[0]/PREF_NUMROWS);
|
||||
else
|
||||
$nbpages = intval($nbcotis->fields[0]/PREF_NUMROWS)+1;
|
||||
$pagestring = "";
|
||||
if ($nbpages==0)
|
||||
$pagestring = "<b>1</b>";
|
||||
else for ($i=1;$i<=$nbpages;$i++)
|
||||
{
|
||||
if ($i!=$page)
|
||||
$pagestring .= "<a href=\"gestion_contributions.php?page=".$i."\">".$i."</a> ";
|
||||
else
|
||||
$pagestring .= $i." ";
|
||||
}
|
||||
?>
|
||||
<DIV id="listfilter">
|
||||
<FORM action="gestion_contributions.php" method="get" name="filtre">
|
||||
<?php echo _T("Afficher les contributions du"); ?>
|
||||
<INPUT type="text" name="contrib_filter_1" maxlength="10" size="10" value="<?php echo $_SESSION["filtre_date_cotis_1"]; ?>">
|
||||
<?php echo _T("au"); ?>
|
||||
<INPUT type="text" name="contrib_filter_2" maxlength="10" size="10" value="<?php echo $_SESSION["filtre_date_cotis_2"]; ?>">
|
||||
<INPUT type="submit" value="<?php echo _T("Filtrer"); ?>">
|
||||
</FORM>
|
||||
</DIV>
|
||||
<TABLE id="infoline" width="100%">
|
||||
<TR>
|
||||
<TD class="left"><?php echo $nbcotis->fields[0]." "; if ($nbcotis->fields[0]!=1) echo _T("contributions"); else echo _T("contribution"); ?></TD>
|
||||
<TD class="right"><?php echo _T("Pages :"); ?> <SPAN class="pagelink"><?php echo $pagestring; ?></SPAN></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<TABLE width="100%">
|
||||
<TR>
|
||||
<TH width="15" class="listing">#</TH>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_contributions.php?tri=0&id_adh=<?php echo $_SESSION["filtre_cotis_adh"] ?>" class="listing"><?php echo _T("Date"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_cotis"]=="0")
|
||||
if ($_SESSION["tri_cotis_sens"]=="0")
|
||||
echo "<IMG src=\"images/asc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
else
|
||||
echo "<IMG src=\"images/desc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
?>
|
||||
</TH>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_contributions.php?tri=1&id_adh=<?php echo $_SESSION["filtre_cotis_adh"] ?>" class="listing"><?php echo _T("Adhérent"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_cotis"]=="1")
|
||||
if ($_SESSION["tri_cotis_sens"]=="0")
|
||||
echo "<IMG src=\"images/asc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
else
|
||||
echo "<IMG src=\"images/desc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
?>
|
||||
</TH>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_contributions.php?tri=2&id_adh=<?php echo $_SESSION["filtre_cotis_adh"] ?>" class="listing"><?php echo _T("Type"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_cotis"]=="2")
|
||||
if ($_SESSION["tri_cotis_sens"]=="0")
|
||||
echo "<IMG src=\"images/asc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
else
|
||||
echo "<IMG src=\"images/desc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
?>
|
||||
</TH>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_contributions.php?tri=3&id_adh=<?php echo $_SESSION["filtre_cotis_adh"] ?>" class="listing"><?php echo _T("Montant"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_cotis"]=="3")
|
||||
if ($_SESSION["tri_cotis_sens"]=="0")
|
||||
echo "<IMG src=\"images/asc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
else
|
||||
echo "<IMG src=\"images/desc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
?>
|
||||
</TH>
|
||||
<TH class="listing left">
|
||||
<A href="gestion_contributions.php?tri=4&id_adh=<?php echo $_SESSION["filtre_cotis_adh"] ?>" class="listing"><?php echo _T("Durée"); ?></A>
|
||||
<?php
|
||||
if ($_SESSION["tri_cotis"]=="4")
|
||||
if ($_SESSION["tri_cotis_sens"]=="0")
|
||||
echo "<IMG src=\"images/asc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
else
|
||||
echo "<IMG src=\"images/desc.png\" width=\"7\" height=\"7\" alt=\"\">";
|
||||
?>
|
||||
</TH>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<TH width="55" class="listing">
|
||||
<?php echo _T("Actions"); ?>
|
||||
</TH>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</TR>
|
||||
<?php
|
||||
$compteur = 1+($page-1)*PREF_NUMROWS;
|
||||
$activity_class = "";
|
||||
if ($resultat->EOF)
|
||||
{
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
$colspan = 7;
|
||||
else
|
||||
$colspan = 5;
|
||||
?>
|
||||
<TR>
|
||||
<TD colspan="<?php echo $colspan; ?>" class="emptylist"><?php echo _T("aucune contribution"); ?></TD>
|
||||
</TR>
|
||||
<?php
|
||||
}
|
||||
else while(!$resultat->EOF)
|
||||
{
|
||||
if ($resultat->fields["duree_mois_cotis"]!="0")
|
||||
$row_class = "cotis-normal";
|
||||
else
|
||||
$row_class = "cotis-give";
|
||||
?>
|
||||
<TR>
|
||||
<TD width="15" class="<?php echo $row_class; ?> center" nowrap><?php echo $compteur ?></TD>
|
||||
<TD width="50" class="<?php echo $row_class; ?>" nowrap>
|
||||
<?php
|
||||
list($a,$m,$j)=explode("-",$resultat->fields["date_cotis"]);
|
||||
echo "$j/$m/$a";
|
||||
?>
|
||||
</TD>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<TD class="<?php echo $row_class; ?>" nowrap>
|
||||
<A href="gestion_contributions.php?id_adh=<?php echo $resultat->fields["id_adh"] ?>"><?php
|
||||
echo htmlentities(strtoupper($resultat->fields["nom_adh"]), ENT_QUOTES)." ";
|
||||
if (isset($resultat->fields["prenom_adh"]))
|
||||
echo htmlentities($resultat->fields["prenom_adh"], ENT_QUOTES);
|
||||
?></A>
|
||||
</TD>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<TD class="<?php echo $row_class; ?>" nowrap><?php echo _T($resultat->fields["libelle_type_cotis"]) ?></TD>
|
||||
<TD class="<?php echo $row_class; ?>" nowrap><?php echo $resultat->fields["montant_cotis"] ?></TD>
|
||||
<TD class="<?php echo $row_class; ?>" nowrap><?php echo $resultat->fields["duree_mois_cotis"] ?></TD>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<TD width="55" class="<?php echo $row_class; ?> center" nowrap>
|
||||
<A href="ajouter_contribution.php?id_cotis=<?php echo $resultat->fields["id_cotis"] ?>"><IMG src="images/icon-edit.png" alt="<?php echo _T("[mod]"); ?>" border="0" width="12" height="13"></A>
|
||||
<A onClick="return confirm('<?php echo str_replace("\n","\\n",addslashes(_T("Voulez-vous vraiment supprimer cette contribution de la base ?"))); ?>')" href="gestion_contributions.php?sup=<?php echo $resultat->fields["id_cotis"] ?>"><IMG src="images/icon-trash.png" alt="<?php echo _T("[sup]"); ?>" border="0" width="11" height="13"></A>
|
||||
</TD>
|
||||
<?php
|
||||
}
|
||||
|
||||
$compteur++;
|
||||
$resultat->MoveNext();
|
||||
}
|
||||
$resultat->Close();
|
||||
?>
|
||||
</TABLE>
|
||||
<DIV id="infoline2" class="right"><?php echo _T("Pages :"); ?> <SPAN class="pagelink"><?php echo $pagestring; ?></SPAN></DIV>
|
||||
<?php
|
||||
// affichage du temps d'ahésion restant si on est en train de visualiser
|
||||
// les cotisations d'un membre unique
|
||||
|
||||
if ($_SESSION["filtre_cotis_adh"]!="")
|
||||
{
|
||||
$requete = "SELECT date_echeance, bool_exempt_adh
|
||||
FROM ".PREFIX_DB."adherents
|
||||
WHERE id_adh='".$_SESSION["filtre_cotis_adh"]."'";
|
||||
$resultat = $DB->Execute($requete);
|
||||
|
||||
// temps d'adhésion
|
||||
if($resultat->fields[1])
|
||||
{
|
||||
$statut_cotis = _T("Exempt de cotisation");
|
||||
$color = "#DDFFDD";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($resultat->fields[0]=="")
|
||||
{
|
||||
$statut_cotis = _T("N'a jamais cotisé");
|
||||
$color = "#EEEEEE";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$date_fin = explode("-",$resultat->fields[0]);
|
||||
$ts_date_fin = mktime(0,0,0,$date_fin[1],$date_fin[2],$date_fin[0]);
|
||||
$aujourdhui = time();
|
||||
|
||||
$difference = intval(($ts_date_fin - $aujourdhui)/(3600*24));
|
||||
if ($difference==0)
|
||||
{
|
||||
$statut_cotis = _T("Dernier jour !");
|
||||
$color = "#FFDDDD";
|
||||
}
|
||||
elseif ($difference<0)
|
||||
{
|
||||
$statut_cotis = _T("En retard de")." ".-$difference." "._T("jours")." ("._T("depuis le")." ".$date_fin[2]."/".$date_fin[1]."/".$date_fin[0].")";
|
||||
$color = "#FFDDDD";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($difference!=1)
|
||||
$statut_cotis = $difference." "._T("jours restants")." ("._T("fin le")." ".$date_fin[2]."/".$date_fin[1]."/".$date_fin[0].")";
|
||||
else
|
||||
$statut_cotis = $difference." "._T("jour restant")." ("._T("fin le")." ".$date_fin[2]."/".$date_fin[1]."/".$date_fin[0].")";
|
||||
if ($difference < 30)
|
||||
$color = "#FFE9AB";
|
||||
else
|
||||
$color = "#DDFFDD";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*$days_left = get_days_left($DB, $_SESSION["filtre_cotis_adh"]);
|
||||
$cumul = $days_left["cumul"];
|
||||
$statut_cotis = $days_left["text"];
|
||||
$color = $days_left["color"];*/
|
||||
?>
|
||||
<BR>
|
||||
<DIV align="center">
|
||||
<TABLE bgcolor="<?php echo $color; ?>">
|
||||
<TR>
|
||||
<TD><?php echo $statut_cotis; ?></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<?php
|
||||
if ($_SESSION["admin_status"]==1)
|
||||
{
|
||||
?>
|
||||
<BR>
|
||||
<A href="voir_adherent.php?id_adh=<?php echo $_SESSION["filtre_cotis_adh"]; ?>"><?php echo _T("[ Voir la fiche adhérent ]"); ?></A>
|
||||
|
||||
<A href="ajouter_contribution.php?id_adh=<?php echo $_SESSION["filtre_cotis_adh"]; ?>"><?php echo _T("[ Ajouter une contribution ]"); ?></A>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
include("footer.php");
|
||||
?>
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
/* header.php
|
||||
* - En-tete
|
||||
* Copyright (c) 2003 Frédéric Jaqcuot
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Galette <?php echo GALETTE_VERSION ?></TITLE>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<LINK rel="stylesheet" type="text/css" href="galette.css" >
|
||||
<style type="text/css">
|
||||
ul.menu {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
ul.menu li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
color: green;
|
||||
}
|
||||
ul.menu a:link, ul.menu a:visited, ul.menu a:hover, ul.menu a:active {
|
||||
color: green;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<DIV id="content">
|
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 783 B |
Before Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 780 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 205 B |
|
@ -1,258 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
* Released under both BSD license and Lesser GPL library license.
|
||||
* Whenever there is any discrepancy between the two licenses,
|
||||
* the BSD license will take precedence.
|
||||
*
|
||||
* Set tabs to 4 for best viewing.
|
||||
*
|
||||
* The following code is adapted from the PEAR DB error handling code.
|
||||
* Portions (c)1997-2002 The PHP Group.
|
||||
*/
|
||||
|
||||
|
||||
if (!defined("DB_ERROR")) define("DB_ERROR",-1);
|
||||
|
||||
if (!defined("DB_ERROR_SYNTAX")) {
|
||||
define("DB_ERROR_SYNTAX", -2);
|
||||
define("DB_ERROR_CONSTRAINT", -3);
|
||||
define("DB_ERROR_NOT_FOUND", -4);
|
||||
define("DB_ERROR_ALREADY_EXISTS", -5);
|
||||
define("DB_ERROR_UNSUPPORTED", -6);
|
||||
define("DB_ERROR_MISMATCH", -7);
|
||||
define("DB_ERROR_INVALID", -8);
|
||||
define("DB_ERROR_NOT_CAPABLE", -9);
|
||||
define("DB_ERROR_TRUNCATED", -10);
|
||||
define("DB_ERROR_INVALID_NUMBER", -11);
|
||||
define("DB_ERROR_INVALID_DATE", -12);
|
||||
define("DB_ERROR_DIVZERO", -13);
|
||||
define("DB_ERROR_NODBSELECTED", -14);
|
||||
define("DB_ERROR_CANNOT_CREATE", -15);
|
||||
define("DB_ERROR_CANNOT_DELETE", -16);
|
||||
define("DB_ERROR_CANNOT_DROP", -17);
|
||||
define("DB_ERROR_NOSUCHTABLE", -18);
|
||||
define("DB_ERROR_NOSUCHFIELD", -19);
|
||||
define("DB_ERROR_NEED_MORE_DATA", -20);
|
||||
define("DB_ERROR_NOT_LOCKED", -21);
|
||||
define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
|
||||
define("DB_ERROR_INVALID_DSN", -23);
|
||||
define("DB_ERROR_CONNECT_FAILED", -24);
|
||||
define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
|
||||
define("DB_ERROR_NOSUCHDB", -25);
|
||||
define("DB_ERROR_ACCESS_VIOLATION", -26);
|
||||
}
|
||||
|
||||
function adodb_errormsg($value)
|
||||
{
|
||||
global $ADODB_LANG,$ADODB_LANG_ARRAY;
|
||||
|
||||
if (empty($ADODB_LANG)) $ADODB_LANG = 'en';
|
||||
if (isset($ADODB_LANG_ARRAY['LANG']) && $ADODB_LANG_ARRAY['LANG'] == $ADODB_LANG) ;
|
||||
else {
|
||||
include_once(ADODB_DIR."/lang/adodb-$ADODB_LANG.inc.php");
|
||||
}
|
||||
return isset($ADODB_LANG_ARRAY[$value]) ? $ADODB_LANG_ARRAY[$value] : $ADODB_LANG_ARRAY[DB_ERROR];
|
||||
}
|
||||
|
||||
function adodb_error($provider,$dbType,$errno)
|
||||
{
|
||||
//var_dump($errno);
|
||||
if (is_numeric($errno) && $errno == 0) return 0;
|
||||
switch($provider) {
|
||||
case 'mysql': $map = adodb_error_mysql(); break;
|
||||
|
||||
case 'oracle':
|
||||
case 'oci8': $map = adodb_error_oci8(); break;
|
||||
|
||||
case 'ibase': $map = adodb_error_ibase(); break;
|
||||
|
||||
case 'odbc': $map = adodb_error_odbc(); break;
|
||||
|
||||
case 'mssql':
|
||||
case 'sybase': $map = adodb_error_mssql(); break;
|
||||
|
||||
case 'informix': $map = adodb_error_ifx(); break;
|
||||
|
||||
case 'postgres': return adodb_error_pg($errno); break;
|
||||
|
||||
case 'sqlite': return $map = adodb_error_sqlite(); break;
|
||||
default:
|
||||
return DB_ERROR;
|
||||
}
|
||||
//print_r($map);
|
||||
//var_dump($errno);
|
||||
if (isset($map[$errno])) return $map[$errno];
|
||||
return DB_ERROR;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
|
||||
function adodb_error_pg($errormsg)
|
||||
{
|
||||
if (is_numeric($errormsg)) return (integer) $errormsg;
|
||||
static $error_regexps = array(
|
||||
'/(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$/' => DB_ERROR_NOSUCHTABLE,
|
||||
'/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/' => DB_ERROR_ALREADY_EXISTS,
|
||||
'/divide by zero$/' => DB_ERROR_DIVZERO,
|
||||
'/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER,
|
||||
'/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD,
|
||||
'/parser: parse error at or near \"/' => DB_ERROR_SYNTAX,
|
||||
'/referential integrity violation/' => DB_ERROR_CONSTRAINT,
|
||||
'/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/'
|
||||
=> DB_ERROR_ALREADY_EXISTS
|
||||
);
|
||||
reset($error_regexps);
|
||||
while (list($regexp,$code) = each($error_regexps)) {
|
||||
if (preg_match($regexp, $errormsg)) {
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
// Fall back to DB_ERROR if there was no mapping.
|
||||
return DB_ERROR;
|
||||
}
|
||||
|
||||
function adodb_error_odbc()
|
||||
{
|
||||
static $MAP = array(
|
||||
'01004' => DB_ERROR_TRUNCATED,
|
||||
'07001' => DB_ERROR_MISMATCH,
|
||||
'21S01' => DB_ERROR_MISMATCH,
|
||||
'21S02' => DB_ERROR_MISMATCH,
|
||||
'22003' => DB_ERROR_INVALID_NUMBER,
|
||||
'22008' => DB_ERROR_INVALID_DATE,
|
||||
'22012' => DB_ERROR_DIVZERO,
|
||||
'23000' => DB_ERROR_CONSTRAINT,
|
||||
'24000' => DB_ERROR_INVALID,
|
||||
'34000' => DB_ERROR_INVALID,
|
||||
'37000' => DB_ERROR_SYNTAX,
|
||||
'42000' => DB_ERROR_SYNTAX,
|
||||
'IM001' => DB_ERROR_UNSUPPORTED,
|
||||
'S0000' => DB_ERROR_NOSUCHTABLE,
|
||||
'S0001' => DB_ERROR_NOT_FOUND,
|
||||
'S0002' => DB_ERROR_NOSUCHTABLE,
|
||||
'S0011' => DB_ERROR_ALREADY_EXISTS,
|
||||
'S0012' => DB_ERROR_NOT_FOUND,
|
||||
'S0021' => DB_ERROR_ALREADY_EXISTS,
|
||||
'S0022' => DB_ERROR_NOT_FOUND,
|
||||
'S1000' => DB_ERROR_NOSUCHTABLE,
|
||||
'S1009' => DB_ERROR_INVALID,
|
||||
'S1090' => DB_ERROR_INVALID,
|
||||
'S1C00' => DB_ERROR_NOT_CAPABLE
|
||||
);
|
||||
return $MAP;
|
||||
}
|
||||
|
||||
function adodb_error_ibase()
|
||||
{
|
||||
static $MAP = array(
|
||||
-104 => DB_ERROR_SYNTAX,
|
||||
-150 => DB_ERROR_ACCESS_VIOLATION,
|
||||
-151 => DB_ERROR_ACCESS_VIOLATION,
|
||||
-155 => DB_ERROR_NOSUCHTABLE,
|
||||
-157 => DB_ERROR_NOSUCHFIELD,
|
||||
-158 => DB_ERROR_VALUE_COUNT_ON_ROW,
|
||||
-170 => DB_ERROR_MISMATCH,
|
||||
-171 => DB_ERROR_MISMATCH,
|
||||
-172 => DB_ERROR_INVALID,
|
||||
-204 => DB_ERROR_INVALID,
|
||||
-205 => DB_ERROR_NOSUCHFIELD,
|
||||
-206 => DB_ERROR_NOSUCHFIELD,
|
||||
-208 => DB_ERROR_INVALID,
|
||||
-219 => DB_ERROR_NOSUCHTABLE,
|
||||
-297 => DB_ERROR_CONSTRAINT,
|
||||
-530 => DB_ERROR_CONSTRAINT,
|
||||
-803 => DB_ERROR_CONSTRAINT,
|
||||
-551 => DB_ERROR_ACCESS_VIOLATION,
|
||||
-552 => DB_ERROR_ACCESS_VIOLATION,
|
||||
-922 => DB_ERROR_NOSUCHDB,
|
||||
-923 => DB_ERROR_CONNECT_FAILED,
|
||||
-924 => DB_ERROR_CONNECT_FAILED
|
||||
);
|
||||
|
||||
return $MAP;
|
||||
}
|
||||
|
||||
function adodb_error_ifx()
|
||||
{
|
||||
static $MAP = array(
|
||||
'-201' => DB_ERROR_SYNTAX,
|
||||
'-206' => DB_ERROR_NOSUCHTABLE,
|
||||
'-217' => DB_ERROR_NOSUCHFIELD,
|
||||
'-329' => DB_ERROR_NODBSELECTED,
|
||||
'-1204' => DB_ERROR_INVALID_DATE,
|
||||
'-1205' => DB_ERROR_INVALID_DATE,
|
||||
'-1206' => DB_ERROR_INVALID_DATE,
|
||||
'-1209' => DB_ERROR_INVALID_DATE,
|
||||
'-1210' => DB_ERROR_INVALID_DATE,
|
||||
'-1212' => DB_ERROR_INVALID_DATE
|
||||
);
|
||||
|
||||
return $MAP;
|
||||
}
|
||||
|
||||
function adodb_error_oci8()
|
||||
{
|
||||
static $MAP = array(
|
||||
1 => DB_ERROR_ALREADY_EXISTS,
|
||||
900 => DB_ERROR_SYNTAX,
|
||||
904 => DB_ERROR_NOSUCHFIELD,
|
||||
923 => DB_ERROR_SYNTAX,
|
||||
942 => DB_ERROR_NOSUCHTABLE,
|
||||
955 => DB_ERROR_ALREADY_EXISTS,
|
||||
1476 => DB_ERROR_DIVZERO,
|
||||
1722 => DB_ERROR_INVALID_NUMBER,
|
||||
2289 => DB_ERROR_NOSUCHTABLE,
|
||||
2291 => DB_ERROR_CONSTRAINT,
|
||||
2449 => DB_ERROR_CONSTRAINT
|
||||
);
|
||||
|
||||
return $MAP;
|
||||
}
|
||||
|
||||
function adodb_error_mssql()
|
||||
{
|
||||
static $MAP = array(
|
||||
208 => DB_ERROR_NOSUCHTABLE,
|
||||
2601 => DB_ERROR_ALREADY_EXISTS
|
||||
);
|
||||
|
||||
return $MAP;
|
||||
}
|
||||
|
||||
function adodb_error_sqlite()
|
||||
{
|
||||
static $MAP = array(
|
||||
1 => DB_ERROR_SYNTAX
|
||||
);
|
||||
|
||||
return $MAP;
|
||||
}
|
||||
|
||||
function adodb_error_mysql()
|
||||
{
|
||||
static $MAP = array(
|
||||
1004 => DB_ERROR_CANNOT_CREATE,
|
||||
1005 => DB_ERROR_CANNOT_CREATE,
|
||||
1006 => DB_ERROR_CANNOT_CREATE,
|
||||
1007 => DB_ERROR_ALREADY_EXISTS,
|
||||
1008 => DB_ERROR_CANNOT_DROP,
|
||||
1045 => DB_ERROR_ACCESS_VIOLATION,
|
||||
1046 => DB_ERROR_NODBSELECTED,
|
||||
1049 => DB_ERROR_NOSUCHDB,
|
||||
1050 => DB_ERROR_ALREADY_EXISTS,
|
||||
1051 => DB_ERROR_NOSUCHTABLE,
|
||||
1054 => DB_ERROR_NOSUCHFIELD,
|
||||
1062 => DB_ERROR_ALREADY_EXISTS,
|
||||
1064 => DB_ERROR_SYNTAX,
|
||||
1100 => DB_ERROR_NOT_LOCKED,
|
||||
1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
|
||||
1146 => DB_ERROR_NOSUCHTABLE,
|
||||
1048 => DB_ERROR_CONSTRAINT,
|
||||
2002 => DB_ERROR_CONNECT_FAILED,
|
||||
2005 => DB_ERROR_CONNECT_FAILED
|
||||
);
|
||||
|
||||
return $MAP;
|
||||
}
|
||||
?>
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
* Released under both BSD license and Lesser GPL library license.
|
||||
* Whenever there is any discrepancy between the two licenses,
|
||||
* the BSD license will take precedence.
|
||||
*
|
||||
* Set tabs to 4 for best viewing.
|
||||
*
|
||||
* Latest version is available at http://php.weblogs.com
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// added Claudio Bustos clbustos#entelchile.net
|
||||
if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
|
||||
|
||||
if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_Handler');
|
||||
|
||||
/**
|
||||
* Default Error Handler. This will be called with the following params
|
||||
*
|
||||
* @param $dbms the RDBMS you are connecting to
|
||||
* @param $fn the name of the calling function (in uppercase)
|
||||
* @param $errno the native error number from the database
|
||||
* @param $errmsg the native error msg from the database
|
||||
* @param $p1 $fn specific parameter - see below
|
||||
* @param $p2 $fn specific parameter - see below
|
||||
* @param $thisConn $current connection object - can be false if no connection object created
|
||||
*/
|
||||
function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
|
||||
{
|
||||
if (error_reporting() == 0) return; // obey @ protocol
|
||||
switch($fn) {
|
||||
case 'EXECUTE':
|
||||
$sql = $p1;
|
||||
$inputparams = $p2;
|
||||
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n";
|
||||
break;
|
||||
|
||||
case 'PCONNECT':
|
||||
case 'CONNECT':
|
||||
$host = $p1;
|
||||
$database = $p2;
|
||||
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n";
|
||||
break;
|
||||
default:
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Log connection error somewhere
|
||||
* 0 message is sent to PHP's system logger, using the Operating System's system
|
||||
* logging mechanism or a file, depending on what the error_log configuration
|
||||
* directive is set to.
|
||||
* 1 message is sent by email to the address in the destination parameter.
|
||||
* This is the only message type where the fourth parameter, extra_headers is used.
|
||||
* This message type uses the same internal function as mail() does.
|
||||
* 2 message is sent through the PHP debugging connection.
|
||||
* This option is only available if remote debugging has been enabled.
|
||||
* In this case, the destination parameter specifies the host name or IP address
|
||||
* and optionally, port number, of the socket receiving the debug information.
|
||||
* 3 message is appended to the file destination
|
||||
*/
|
||||
if (defined('ADODB_ERROR_LOG_TYPE')) {
|
||||
$t = date('Y-m-d H:i:s');
|
||||
if (defined('ADODB_ERROR_LOG_DEST'))
|
||||
error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST);
|
||||
else
|
||||
error_log("($t) $s", ADODB_ERROR_LOG_TYPE);
|
||||
}
|
||||
|
||||
|
||||
//print "<p>$s</p>";
|
||||
trigger_error($s,ADODB_ERROR_HANDLER_TYPE);
|
||||
}
|
||||
?>
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @version V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
* Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
*
|
||||
* Set tabs to 4 for best viewing.
|
||||
*
|
||||
* Latest version is available at http://php.weblogs.com
|
||||
*
|
||||
*/
|
||||
include_once('PEAR.php');
|
||||
|
||||
if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR');
|
||||
|
||||
/*
|
||||
* Enabled the following if you want to terminate scripts when an error occurs
|
||||
*/
|
||||
//PEAR::setErrorHandling (PEAR_ERROR_DIE);
|
||||
|
||||
/*
|
||||
* Name of the PEAR_Error derived class to call.
|
||||
*/
|
||||
if (!defined('ADODB_PEAR_ERROR_CLASS')) define('ADODB_PEAR_ERROR_CLASS','PEAR_Error');
|
||||
|
||||
/*
|
||||
* Store the last PEAR_Error object here
|
||||
*/
|
||||
global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
|
||||
|
||||
/**
|
||||
* Error Handler with PEAR support. This will be called with the following params
|
||||
*
|
||||
* @param $dbms the RDBMS you are connecting to
|
||||
* @param $fn the name of the calling function (in uppercase)
|
||||
* @param $errno the native error number from the database
|
||||
* @param $errmsg the native error msg from the database
|
||||
* @param $p1 $fn specific parameter - see below
|
||||
* @param $P2 $fn specific parameter - see below
|
||||
*/
|
||||
function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
|
||||
{
|
||||
global $ADODB_Last_PEAR_Error;
|
||||
|
||||
if (error_reporting() == 0) return; // obey @ protocol
|
||||
switch($fn) {
|
||||
case 'EXECUTE':
|
||||
$sql = $p1;
|
||||
$inputparams = $p2;
|
||||
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
|
||||
break;
|
||||
|
||||
case 'PCONNECT':
|
||||
case 'CONNECT':
|
||||
$host = $p1;
|
||||
$database = $p2;
|
||||
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, '$database')";
|
||||
break;
|
||||
|
||||
default:
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
|
||||
break;
|
||||
}
|
||||
|
||||
$class = ADODB_PEAR_ERROR_CLASS;
|
||||
$ADODB_Last_PEAR_Error = new $class($s, $errno,
|
||||
$GLOBALS['_PEAR_default_error_mode'],
|
||||
$GLOBALS['_PEAR_default_error_options'],
|
||||
$errmsg);
|
||||
|
||||
//print "<p>!$s</p>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last PEAR_Error object. This error might be for an error that
|
||||
* occured several sql statements ago.
|
||||
*/
|
||||
function ADODB_PEAR_Error()
|
||||
{
|
||||
global $ADODB_Last_PEAR_Error;
|
||||
|
||||
return $ADODB_Last_PEAR_Error;
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
* Released under both BSD license and Lesser GPL library license.
|
||||
* Whenever there is any discrepancy between the two licenses,
|
||||
* the BSD license will take precedence.
|
||||
*
|
||||
* Set tabs to 4 for best viewing.
|
||||
*
|
||||
* Latest version is available at http://php.weblogs.com
|
||||
*
|
||||
* Exception-handling code using PHP5 exceptions (try-catch-throw).
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
|
||||
define('ADODB_ERROR_HANDLER','adodb_throw');
|
||||
|
||||
class ADODB_Exception extends Exception {
|
||||
var $dbms;
|
||||
var $fn;
|
||||
var $sql = '';
|
||||
var $params = '';
|
||||
var $host = '';
|
||||
var $database = '';
|
||||
|
||||
function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
|
||||
{
|
||||
switch($fn) {
|
||||
case 'EXECUTE':
|
||||
$this->sql = $p1;
|
||||
$this->params = $p2;
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n";
|
||||
break;
|
||||
|
||||
case 'PCONNECT':
|
||||
case 'CONNECT':
|
||||
$user = $thisConnection->user;
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n";
|
||||
break;
|
||||
default:
|
||||
$s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
|
||||
break;
|
||||
}
|
||||
|
||||
$this->dbms = $dbms;
|
||||
$this->host = $thisConnection->host;
|
||||
$this->database = $thisConnection->database;
|
||||
$this->fn = $fn;
|
||||
$this->msg = $errmsg;
|
||||
|
||||
if (!is_numeric($errno)) $errno = -1;
|
||||
parent::__construct($s,$errno);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Error Handler. This will be called with the following params
|
||||
*
|
||||
* @param $dbms the RDBMS you are connecting to
|
||||
* @param $fn the name of the calling function (in uppercase)
|
||||
* @param $errno the native error number from the database
|
||||
* @param $errmsg the native error msg from the database
|
||||
* @param $p1 $fn specific parameter - see below
|
||||
* @param $P2 $fn specific parameter - see below
|
||||
*/
|
||||
|
||||
function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
|
||||
{
|
||||
global $ADODB_EXCEPTION;
|
||||
|
||||
if (error_reporting() == 0) return; // obey @ protocol
|
||||
if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION;
|
||||
else $errfn = 'ADODB_EXCEPTION';
|
||||
throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection);
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,84 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
||||
Set tabs to 4.
|
||||
|
||||
Declares the ADODB Base Class for PHP5 "ADODB_BASE_RS", and supports iteration with
|
||||
the ADODB_Iterator class.
|
||||
|
||||
$rs = $db->Execute("select * from adoxyz");
|
||||
foreach($rs as $k => $v) {
|
||||
echo $k; print_r($v); echo "<br>";
|
||||
}
|
||||
|
||||
|
||||
Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
|
||||
*/
|
||||
|
||||
|
||||
class ADODB_Iterator implements Iterator {
|
||||
|
||||
private $rs;
|
||||
|
||||
function __construct($rs)
|
||||
{
|
||||
$this->rs = $rs;
|
||||
}
|
||||
function rewind()
|
||||
{
|
||||
$this->rs->MoveFirst();
|
||||
}
|
||||
|
||||
function valid()
|
||||
{
|
||||
return !$this->rs->EOF;
|
||||
}
|
||||
|
||||
function key()
|
||||
{
|
||||
return $this->rs->_currentRow;
|
||||
}
|
||||
|
||||
function current()
|
||||
{
|
||||
return $this->rs->fields;
|
||||
}
|
||||
|
||||
function next()
|
||||
{
|
||||
$this->rs->MoveNext();
|
||||
}
|
||||
|
||||
function __call($func, $params)
|
||||
{
|
||||
return call_user_func_array(array($this->rs, $func), $params);
|
||||
}
|
||||
|
||||
|
||||
function hasMore()
|
||||
{
|
||||
return !$this->rs->EOF;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ADODB_BASE_RS implements IteratorAggregate {
|
||||
function getIterator() {
|
||||
return new ADODB_Iterator($this);
|
||||
}
|
||||
|
||||
/* this is experimental - i don't really know what to return... */
|
||||
function __toString()
|
||||
{
|
||||
include_once(ADODB_DIR.'/toexport.inc.php');
|
||||
return _adodb_export($this,',',',',false,true);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,290 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
This class provides recordset pagination with
|
||||
First/Prev/Next/Last links.
|
||||
|
||||
Feel free to modify this class for your own use as
|
||||
it is very basic. To learn how to use it, see the
|
||||
example in adodb/tests/testpaging.php.
|
||||
|
||||
"Pablo Costa" <pablo@cbsp.com.br> implemented Render_PageLinks().
|
||||
|
||||
Please note, this class is entirely unsupported,
|
||||
and no free support requests except for bug reports
|
||||
will be entertained by the author.
|
||||
|
||||
*/
|
||||
class ADODB_Pager {
|
||||
var $id; // unique id for pager (defaults to 'adodb')
|
||||
var $db; // ADODB connection object
|
||||
var $sql; // sql used
|
||||
var $rs; // recordset generated
|
||||
var $curr_page; // current page number before Render() called, calculated in constructor
|
||||
var $rows; // number of rows per page
|
||||
var $linksPerPage=10; // number of links per page in navigation bar
|
||||
var $showPageLinks;
|
||||
|
||||
var $gridAttributes = 'width=100% border=1 bgcolor=white';
|
||||
|
||||
// Localize text strings here
|
||||
var $first = '<code>|<</code>';
|
||||
var $prev = '<code><<</code>';
|
||||
var $next = '<code>>></code>';
|
||||
var $last = '<code>>|</code>';
|
||||
var $moreLinks = '...';
|
||||
var $startLinks = '...';
|
||||
var $gridHeader = false;
|
||||
var $htmlSpecialChars = true;
|
||||
var $page = 'Page';
|
||||
var $linkSelectedColor = 'red';
|
||||
var $cache = 0; #secs to cache with CachePageExecute()
|
||||
|
||||
//----------------------------------------------
|
||||
// constructor
|
||||
//
|
||||
// $db adodb connection object
|
||||
// $sql sql statement
|
||||
// $id optional id to identify which pager,
|
||||
// if you have multiple on 1 page.
|
||||
// $id should be only be [a-z0-9]*
|
||||
//
|
||||
function ADODB_Pager(&$db,$sql,$id = 'adodb', $showPageLinks = false)
|
||||
{
|
||||
global $PHP_SELF;
|
||||
|
||||
$curr_page = $id.'_curr_page';
|
||||
if (empty($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];
|
||||
|
||||
$this->sql = $sql;
|
||||
$this->id = $id;
|
||||
$this->db = $db;
|
||||
$this->showPageLinks = $showPageLinks;
|
||||
|
||||
$next_page = $id.'_next_page';
|
||||
|
||||
if (isset($_GET[$next_page])) {
|
||||
$_SESSION[$curr_page] = $_GET[$next_page];
|
||||
}
|
||||
if (empty($_SESSION[$curr_page])) $_SESSION[$curr_page] = 1; ## at first page
|
||||
|
||||
$this->curr_page = $_SESSION[$curr_page];
|
||||
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
// Display link to first page
|
||||
function Render_First($anchor=true)
|
||||
{
|
||||
global $PHP_SELF;
|
||||
if ($anchor) {
|
||||
?>
|
||||
<a href="<?php echo $PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a>
|
||||
<?php
|
||||
} else {
|
||||
print "$this->first ";
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// Display link to next page
|
||||
function render_next($anchor=true)
|
||||
{
|
||||
global $PHP_SELF;
|
||||
|
||||
if ($anchor) {
|
||||
?>
|
||||
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php echo $this->next;?></a>
|
||||
<?php
|
||||
} else {
|
||||
print "$this->next ";
|
||||
}
|
||||
}
|
||||
|
||||
//------------------
|
||||
// Link to last page
|
||||
//
|
||||
// for better performance with large recordsets, you can set
|
||||
// $this->db->pageExecuteCountRows = false, which disables
|
||||
// last page counting.
|
||||
function render_last($anchor=true)
|
||||
{
|
||||
global $PHP_SELF;
|
||||
|
||||
if (!$this->db->pageExecuteCountRows) return;
|
||||
|
||||
if ($anchor) {
|
||||
?>
|
||||
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo $this->last;?></a>
|
||||
<?php
|
||||
} else {
|
||||
print "$this->last ";
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
// original code by "Pablo Costa" <pablo@cbsp.com.br>
|
||||
function render_pagelinks()
|
||||
{
|
||||
global $PHP_SELF;
|
||||
$pages = $this->rs->LastPageNo();
|
||||
$linksperpage = $this->linksPerPage ? $this->linksPerPage : $pages;
|
||||
for($i=1; $i <= $pages; $i+=$linksperpage)
|
||||
{
|
||||
if($this->rs->AbsolutePage() >= $i)
|
||||
{
|
||||
$start = $i;
|
||||
}
|
||||
}
|
||||
$numbers = '';
|
||||
$end = $start+$linksperpage-1;
|
||||
$link = $this->id . "_next_page";
|
||||
if($end > $pages) $end = $pages;
|
||||
|
||||
|
||||
if ($this->startLinks && $start > 1) {
|
||||
$pos = $start - 1;
|
||||
$numbers .= "<a href=$PHP_SELF?$link=$pos>$this->startLinks</a> ";
|
||||
}
|
||||
|
||||
for($i=$start; $i <= $end; $i++) {
|
||||
if ($this->rs->AbsolutePage() == $i)
|
||||
$numbers .= "<font color=$this->linkSelectedColor><b>$i</b></font> ";
|
||||
else
|
||||
$numbers .= "<a href=$PHP_SELF?$link=$i>$i</a> ";
|
||||
|
||||
}
|
||||
if ($this->moreLinks && $end < $pages)
|
||||
$numbers .= "<a href=$PHP_SELF?$link=$i>$this->moreLinks</a> ";
|
||||
print $numbers . ' ';
|
||||
}
|
||||
// Link to previous page
|
||||
function render_prev($anchor=true)
|
||||
{
|
||||
global $PHP_SELF;
|
||||
if ($anchor) {
|
||||
?>
|
||||
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php echo $this->prev;?></a>
|
||||
<?php
|
||||
} else {
|
||||
print "$this->prev ";
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Simply rendering of grid. You should override this for
|
||||
// better control over the format of the grid
|
||||
//
|
||||
// We use output buffering to keep code clean and readable.
|
||||
function RenderGrid()
|
||||
{
|
||||
global $gSQLBlockRows; // used by rs2html to indicate how many rows to display
|
||||
include_once(ADODB_DIR.'/tohtml.inc.php');
|
||||
ob_start();
|
||||
$gSQLBlockRows = $this->rows;
|
||||
rs2html($this->rs,$this->gridAttributes,$this->gridHeader,$this->htmlSpecialChars);
|
||||
$s = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $s;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Navigation bar
|
||||
//
|
||||
// we use output buffering to keep the code easy to read.
|
||||
function RenderNav()
|
||||
{
|
||||
ob_start();
|
||||
if (!$this->rs->AtFirstPage()) {
|
||||
$this->Render_First();
|
||||
$this->Render_Prev();
|
||||
} else {
|
||||
$this->Render_First(false);
|
||||
$this->Render_Prev(false);
|
||||
}
|
||||
if ($this->showPageLinks){
|
||||
$this->Render_PageLinks();
|
||||
}
|
||||
if (!$this->rs->AtLastPage()) {
|
||||
$this->Render_Next();
|
||||
$this->Render_Last();
|
||||
} else {
|
||||
$this->Render_Next(false);
|
||||
$this->Render_Last(false);
|
||||
}
|
||||
$s = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $s;
|
||||
}
|
||||
|
||||
//-------------------
|
||||
// This is the footer
|
||||
function RenderPageCount()
|
||||
{
|
||||
if (!$this->db->pageExecuteCountRows) return '';
|
||||
$lastPage = $this->rs->LastPageNo();
|
||||
if ($lastPage == -1) $lastPage = 1; // check for empty rs.
|
||||
if ($this->curr_page > $lastPage) $this->curr_page = 1;
|
||||
return "<font size=-1>$this->page ".$this->curr_page."/".$lastPage."</font>";
|
||||
}
|
||||
|
||||
//-----------------------------------
|
||||
// Call this class to draw everything.
|
||||
function Render($rows=10)
|
||||
{
|
||||
global $ADODB_COUNTRECS;
|
||||
|
||||
$this->rows = $rows;
|
||||
|
||||
if ($this->db->dataProvider == 'informix') $this->db->cursorType = IFX_SCROLL;
|
||||
|
||||
$savec = $ADODB_COUNTRECS;
|
||||
if ($this->db->pageExecuteCountRows) $ADODB_COUNTRECS = true;
|
||||
if ($this->cache)
|
||||
$rs = &$this->db->CachePageExecute($this->cache,$this->sql,$rows,$this->curr_page);
|
||||
else
|
||||
$rs = &$this->db->PageExecute($this->sql,$rows,$this->curr_page);
|
||||
$ADODB_COUNTRECS = $savec;
|
||||
|
||||
$this->rs = &$rs;
|
||||
if (!$rs) {
|
||||
print "<h3>Query failed: $this->sql</h3>";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$rs->EOF && (!$rs->AtFirstPage() || !$rs->AtLastPage()))
|
||||
$header = $this->RenderNav();
|
||||
else
|
||||
$header = " ";
|
||||
|
||||
$grid = $this->RenderGrid();
|
||||
$footer = $this->RenderPageCount();
|
||||
|
||||
$this->RenderLayout($header,$grid,$footer);
|
||||
|
||||
$rs->Close();
|
||||
$this->rs = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// override this to control overall layout and formating
|
||||
function RenderLayout($header,$grid,$footer,$attributes='border=1 bgcolor=beige')
|
||||
{
|
||||
echo "<table ".$attributes."><tr><td>",
|
||||
$header,
|
||||
"</td></tr><tr><td>",
|
||||
$grid,
|
||||
"</td></tr><tr><td>",
|
||||
$footer,
|
||||
"</td></tr></table>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,374 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @version V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
* Released under both BSD license and Lesser GPL library license.
|
||||
* Whenever there is any discrepancy between the two licenses,
|
||||
* the BSD license will take precedence.
|
||||
*
|
||||
* Set tabs to 4 for best viewing.
|
||||
*
|
||||
* PEAR DB Emulation Layer for ADODB.
|
||||
*
|
||||
* The following code is modelled on PEAR DB code by Stig Bakken <ssb@fast.no> |
|
||||
* and Tomas V.V.Cox <cox@idecnet.com>. Portions (c)1997-2002 The PHP Group.
|
||||
*/
|
||||
|
||||
/*
|
||||
We support:
|
||||
|
||||
DB_Common
|
||||
---------
|
||||
query - returns PEAR_Error on error
|
||||
limitQuery - return PEAR_Error on error
|
||||
prepare - does not return PEAR_Error on error
|
||||
execute - does not return PEAR_Error on error
|
||||
setFetchMode - supports ASSOC and ORDERED
|
||||
errorNative
|
||||
quote
|
||||
nextID
|
||||
disconnect
|
||||
|
||||
getOne
|
||||
getAssoc
|
||||
getRow
|
||||
getCol
|
||||
getAll
|
||||
|
||||
DB_Result
|
||||
---------
|
||||
numRows - returns -1 if not supported
|
||||
numCols
|
||||
fetchInto - does not support passing of fetchmode
|
||||
fetchRows - does not support passing of fetchmode
|
||||
free
|
||||
*/
|
||||
|
||||
define('ADODB_PEAR',dirname(__FILE__));
|
||||
include_once "PEAR.php";
|
||||
include_once ADODB_PEAR."/adodb-errorpear.inc.php";
|
||||
include_once ADODB_PEAR."/adodb.inc.php";
|
||||
|
||||
if (!defined('DB_OK')) {
|
||||
define("DB_OK", 1);
|
||||
define("DB_ERROR",-1);
|
||||
|
||||
// autoExecute constants
|
||||
define('DB_AUTOQUERY_INSERT', 1);
|
||||
define('DB_AUTOQUERY_UPDATE', 2);
|
||||
|
||||
/**
|
||||
* This is a special constant that tells DB the user hasn't specified
|
||||
* any particular get mode, so the default should be used.
|
||||
*/
|
||||
|
||||
define('DB_FETCHMODE_DEFAULT', 0);
|
||||
|
||||
/**
|
||||
* Column data indexed by numbers, ordered from 0 and up
|
||||
*/
|
||||
|
||||
define('DB_FETCHMODE_ORDERED', 1);
|
||||
|
||||
/**
|
||||
* Column data indexed by column names
|
||||
*/
|
||||
|
||||
define('DB_FETCHMODE_ASSOC', 2);
|
||||
|
||||
/* for compatibility */
|
||||
|
||||
define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
|
||||
define('DB_GETMODE_ASSOC', DB_FETCHMODE_ASSOC);
|
||||
|
||||
/**
|
||||
* these are constants for the tableInfo-function
|
||||
* they are bitwised or'ed. so if there are more constants to be defined
|
||||
* in the future, adjust DB_TABLEINFO_FULL accordingly
|
||||
*/
|
||||
|
||||
define('DB_TABLEINFO_ORDER', 1);
|
||||
define('DB_TABLEINFO_ORDERTABLE', 2);
|
||||
define('DB_TABLEINFO_FULL', 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* The main "DB" class is simply a container class with some static
|
||||
* methods for creating DB objects as well as some utility functions
|
||||
* common to all parts of DB.
|
||||
*
|
||||
*/
|
||||
|
||||
class DB
|
||||
{
|
||||
/**
|
||||
* Create a new DB object for the specified database type
|
||||
*
|
||||
* @param $type string database type, for example "mysql"
|
||||
*
|
||||
* @return object a newly created DB object, or a DB error code on
|
||||
* error
|
||||
*/
|
||||
|
||||
function factory($type)
|
||||
{
|
||||
include_once(ADODB_DIR."/drivers/adodb-$type.inc.php");
|
||||
$obj = &NewADOConnection($type);
|
||||
if (!is_object($obj)) $obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DB object and connect to the specified database
|
||||
*
|
||||
* @param $dsn mixed "data source name", see the DB::parseDSN
|
||||
* method for a description of the dsn format. Can also be
|
||||
* specified as an array of the format returned by DB::parseDSN.
|
||||
*
|
||||
* @param $options mixed if boolean (or scalar), tells whether
|
||||
* this connection should be persistent (for backends that support
|
||||
* this). This parameter can also be an array of options, see
|
||||
* DB_common::setOption for more information on connection
|
||||
* options.
|
||||
*
|
||||
* @return object a newly created DB connection object, or a DB
|
||||
* error object on error
|
||||
*
|
||||
* @see DB::parseDSN
|
||||
* @see DB::isError
|
||||
*/
|
||||
function connect($dsn, $options = false)
|
||||
{
|
||||
if (is_array($dsn)) {
|
||||
$dsninfo = $dsn;
|
||||
} else {
|
||||
$dsninfo = DB::parseDSN($dsn);
|
||||
}
|
||||
switch ($dsninfo["phptype"]) {
|
||||
case 'pgsql': $type = 'postgres7'; break;
|
||||
case 'ifx': $type = 'informix9'; break;
|
||||
default: $type = $dsninfo["phptype"]; break;
|
||||
}
|
||||
|
||||
if (is_array($options) && isset($options["debug"]) &&
|
||||
$options["debug"] >= 2) {
|
||||
// expose php errors with sufficient debug level
|
||||
@include_once("adodb-$type.inc.php");
|
||||
} else {
|
||||
@include_once("adodb-$type.inc.php");
|
||||
}
|
||||
|
||||
@$obj =& NewADOConnection($type);
|
||||
if (!is_object($obj)) {
|
||||
$obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1);
|
||||
return $obj;
|
||||
}
|
||||
if (is_array($options)) {
|
||||
foreach($options as $k => $v) {
|
||||
switch(strtolower($k)) {
|
||||
case 'persist':
|
||||
case 'persistent': $persist = $v; break;
|
||||
#ibase
|
||||
case 'dialect': $obj->dialect = $v; break;
|
||||
case 'charset': $obj->charset = $v; break;
|
||||
case 'buffers': $obj->buffers = $v; break;
|
||||
#ado
|
||||
case 'charpage': $obj->charPage = $v; break;
|
||||
#mysql
|
||||
case 'clientflags': $obj->clientFlags = $v; break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$persist = false;
|
||||
}
|
||||
|
||||
if (isset($dsninfo['socket'])) $dsninfo['hostspec'] .= ':'.$dsninfo['socket'];
|
||||
else if (isset($dsninfo['port'])) $dsninfo['hostspec'] .= ':'.$dsninfo['port'];
|
||||
|
||||
if($persist) $ok = $obj->PConnect($dsninfo['hostspec'], $dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
|
||||
else $ok = $obj->Connect($dsninfo['hostspec'], $dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
|
||||
|
||||
if (!$ok) $obj = ADODB_PEAR_Error();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DB API version
|
||||
*
|
||||
* @return int the DB API version number
|
||||
*/
|
||||
function apiVersion()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether a result code from a DB method is an error
|
||||
*
|
||||
* @param $value int result code
|
||||
*
|
||||
* @return bool whether $value is an error
|
||||
*/
|
||||
function isError($value)
|
||||
{
|
||||
if (!is_object($value)) return false;
|
||||
$class = get_class($value);
|
||||
return $class == 'pear_error' || is_subclass_of($value, 'pear_error') ||
|
||||
$class == 'db_error' || is_subclass_of($value, 'db_error');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tell whether a result code from a DB method is a warning.
|
||||
* Warnings differ from errors in that they are generated by DB,
|
||||
* and are not fatal.
|
||||
*
|
||||
* @param $value mixed result value
|
||||
*
|
||||
* @return bool whether $value is a warning
|
||||
*/
|
||||
function isWarning($value)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
return is_object($value) &&
|
||||
(get_class( $value ) == "db_warning" ||
|
||||
is_subclass_of($value, "db_warning"));*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a data source name
|
||||
*
|
||||
* @param $dsn string Data Source Name to be parsed
|
||||
*
|
||||
* @return array an associative array with the following keys:
|
||||
*
|
||||
* phptype: Database backend used in PHP (mysql, odbc etc.)
|
||||
* dbsyntax: Database used with regards to SQL syntax etc.
|
||||
* protocol: Communication protocol to use (tcp, unix etc.)
|
||||
* hostspec: Host specification (hostname[:port])
|
||||
* database: Database to use on the DBMS server
|
||||
* username: User name for login
|
||||
* password: Password for login
|
||||
*
|
||||
* The format of the supplied DSN is in its fullest form:
|
||||
*
|
||||
* phptype(dbsyntax)://username:password@protocol+hostspec/database
|
||||
*
|
||||
* Most variations are allowed:
|
||||
*
|
||||
* phptype://username:password@protocol+hostspec:110//usr/db_file.db
|
||||
* phptype://username:password@hostspec/database_name
|
||||
* phptype://username:password@hostspec
|
||||
* phptype://username@hostspec
|
||||
* phptype://hostspec/database
|
||||
* phptype://hostspec
|
||||
* phptype(dbsyntax)
|
||||
* phptype
|
||||
*
|
||||
* @author Tomas V.V.Cox <cox@idecnet.com>
|
||||
*/
|
||||
function parseDSN($dsn)
|
||||
{
|
||||
if (is_array($dsn)) {
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
$parsed = array(
|
||||
'phptype' => false,
|
||||
'dbsyntax' => false,
|
||||
'protocol' => false,
|
||||
'hostspec' => false,
|
||||
'database' => false,
|
||||
'username' => false,
|
||||
'password' => false
|
||||
);
|
||||
|
||||
// Find phptype and dbsyntax
|
||||
if (($pos = strpos($dsn, '://')) !== false) {
|
||||
$str = substr($dsn, 0, $pos);
|
||||
$dsn = substr($dsn, $pos + 3);
|
||||
} else {
|
||||
$str = $dsn;
|
||||
$dsn = NULL;
|
||||
}
|
||||
|
||||
// Get phptype and dbsyntax
|
||||
// $str => phptype(dbsyntax)
|
||||
if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
|
||||
$parsed['phptype'] = $arr[1];
|
||||
$parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2];
|
||||
} else {
|
||||
$parsed['phptype'] = $str;
|
||||
$parsed['dbsyntax'] = $str;
|
||||
}
|
||||
|
||||
if (empty($dsn)) {
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
// Get (if found): username and password
|
||||
// $dsn => username:password@protocol+hostspec/database
|
||||
if (($at = strpos($dsn,'@')) !== false) {
|
||||
$str = substr($dsn, 0, $at);
|
||||
$dsn = substr($dsn, $at + 1);
|
||||
if (($pos = strpos($str, ':')) !== false) {
|
||||
$parsed['username'] = urldecode(substr($str, 0, $pos));
|
||||
$parsed['password'] = urldecode(substr($str, $pos + 1));
|
||||
} else {
|
||||
$parsed['username'] = urldecode($str);
|
||||
}
|
||||
}
|
||||
|
||||
// Find protocol and hostspec
|
||||
// $dsn => protocol+hostspec/database
|
||||
if (($pos=strpos($dsn, '/')) !== false) {
|
||||
$str = substr($dsn, 0, $pos);
|
||||
$dsn = substr($dsn, $pos + 1);
|
||||
} else {
|
||||
$str = $dsn;
|
||||
$dsn = NULL;
|
||||
}
|
||||
|
||||
// Get protocol + hostspec
|
||||
// $str => protocol+hostspec
|
||||
if (($pos=strpos($str, '+')) !== false) {
|
||||
$parsed['protocol'] = substr($str, 0, $pos);
|
||||
$parsed['hostspec'] = urldecode(substr($str, $pos + 1));
|
||||
} else {
|
||||
$parsed['hostspec'] = urldecode($str);
|
||||
}
|
||||
|
||||
// Get dabase if any
|
||||
// $dsn => database
|
||||
if (!empty($dsn)) {
|
||||
$parsed['database'] = $dsn;
|
||||
}
|
||||
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a PHP database extension if it is not loaded already.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param $name the base name of the extension (without the .so or
|
||||
* .dll suffix)
|
||||
*
|
||||
* @return bool true if the extension was already or successfully
|
||||
* loaded, false if it could not be loaded
|
||||
*/
|
||||
function assertExtension($name)
|
||||
{
|
||||
if (!extension_loaded($name)) {
|
||||
$dlext = (strncmp(PHP_OS,'WIN',3) === 0) ? '.dll' : '.so';
|
||||
@dl($name . $dlext);
|
||||
}
|
||||
if (!extension_loaded($name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
V4.71 24 Jan 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
||||
Set tabs to 4.
|
||||
*/
|
||||
|
||||
|
||||
class ADODB_BASE_RS {
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,183 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Helper functions to convert between ADODB recordset objects and XMLRPC values.
|
||||
* Uses John Lim's AdoDB and Edd Dumbill's phpxmlrpc libs
|
||||
*
|
||||
* @author Daniele Baroncelli
|
||||
* @author Gaetano Giunta
|
||||
* @copyright (c) 2003-2004 Giunta/Baroncelli. All rights reserved.
|
||||
*
|
||||
* @todo some more error checking here and there
|
||||
* @todo document the xmlrpc-struct used to encode recordset info
|
||||
* @todo verify if using xmlrpc_encode($rs->GetArray()) would work with:
|
||||
* - ADODB_FETCH_BOTH
|
||||
* - null values
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include the main libraries
|
||||
*/
|
||||
require_once('xmlrpc.inc');
|
||||
if (!defined('ADODB_DIR')) require_once('adodb.inc.php');
|
||||
|
||||
/**
|
||||
* Builds an xmlrpc struct value out of an AdoDB recordset
|
||||
*/
|
||||
function rs2xmlrpcval(&$adodbrs) {
|
||||
|
||||
$header =& rs2xmlrpcval_header($adodbrs);
|
||||
$body =& rs2xmlrpcval_body($adodbrs);
|
||||
|
||||
// put it all together and build final xmlrpc struct
|
||||
$xmlrpcrs = new xmlrpcval ( array(
|
||||
"header" => $header,
|
||||
"body" => $body,
|
||||
), "struct");
|
||||
|
||||
return $xmlrpcrs;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an xmlrpc struct value describing an AdoDB recordset
|
||||
*/
|
||||
function rs2xmlrpcval_header($adodbrs)
|
||||
{
|
||||
$numfields = $adodbrs->FieldCount();
|
||||
$numrecords = $adodbrs->RecordCount();
|
||||
|
||||
// build structure holding recordset information
|
||||
$fieldstruct = array();
|
||||
for ($i = 0; $i < $numfields; $i++) {
|
||||
$fld = $adodbrs->FetchField($i);
|
||||
$fieldarray = array();
|
||||
if (isset($fld->name))
|
||||
$fieldarray["name"] = new xmlrpcval ($fld->name);
|
||||
if (isset($fld->type))
|
||||
$fieldarray["type"] = new xmlrpcval ($fld->type);
|
||||
if (isset($fld->max_length))
|
||||
$fieldarray["max_length"] = new xmlrpcval ($fld->max_length, "int");
|
||||
if (isset($fld->not_null))
|
||||
$fieldarray["not_null"] = new xmlrpcval ($fld->not_null, "boolean");
|
||||
if (isset($fld->has_default))
|
||||
$fieldarray["has_default"] = new xmlrpcval ($fld->has_default, "boolean");
|
||||
if (isset($fld->default_value))
|
||||
$fieldarray["default_value"] = new xmlrpcval ($fld->default_value);
|
||||
$fieldstruct[$i] = new xmlrpcval ($fieldarray, "struct");
|
||||
}
|
||||
$fieldcount = new xmlrpcval ($numfields, "int");
|
||||
$recordcount = new xmlrpcval ($numrecords, "int");
|
||||
$sql = new xmlrpcval ($adodbrs->sql);
|
||||
$fieldinfo = new xmlrpcval ($fieldstruct, "array");
|
||||
|
||||
$header = new xmlrpcval ( array(
|
||||
"fieldcount" => $fieldcount,
|
||||
"recordcount" => $recordcount,
|
||||
"sql" => $sql,
|
||||
"fieldinfo" => $fieldinfo
|
||||
), "struct");
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an xmlrpc struct value out of an AdoDB recordset
|
||||
* (data values only, no data definition)
|
||||
*/
|
||||
function rs2xmlrpcval_body($adodbrs)
|
||||
{
|
||||
$numfields = $adodbrs->FieldCount();
|
||||
|
||||
// build structure containing recordset data
|
||||
$adodbrs->MoveFirst();
|
||||
$rows = array();
|
||||
while (!$adodbrs->EOF) {
|
||||
$columns = array();
|
||||
// This should work on all cases of fetch mode: assoc, num, both or default
|
||||
if ($adodbrs->fetchMode == 'ADODB_FETCH_BOTH' || count($adodbrs->fields) == 2 * $adodbrs->FieldCount())
|
||||
for ($i = 0; $i < $numfields; $i++)
|
||||
if ($adodbrs->fields[$i] === null)
|
||||
$columns[$i] = new xmlrpcval ('');
|
||||
else
|
||||
$columns[$i] =& xmlrpc_encode ($adodbrs->fields[$i]);
|
||||
else
|
||||
foreach ($adodbrs->fields as $val)
|
||||
if ($val === null)
|
||||
$columns[] = new xmlrpcval ('');
|
||||
else
|
||||
$columns[] =& xmlrpc_encode ($val);
|
||||
|
||||
$rows[] = new xmlrpcval ($columns, "array");
|
||||
|
||||
$adodbrs->MoveNext();
|
||||
}
|
||||
$body = new xmlrpcval ($rows, "array");
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an xmlrpc struct value as string out of an AdoDB recordset
|
||||
*/
|
||||
function rs2xmlrpcstring (&$adodbrs) {
|
||||
$xmlrpc = rs2xmlrpcval ($adodbrs);
|
||||
if ($xmlrpc)
|
||||
return $xmlrpc->serialize();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a well-formed xmlrpc struct object returns an AdoDB object
|
||||
*
|
||||
* @todo add some error checking on the input value
|
||||
*/
|
||||
function xmlrpcval2rs (&$xmlrpcval) {
|
||||
|
||||
$fields_array = array();
|
||||
$data_array = array();
|
||||
|
||||
// rebuild column information
|
||||
$header =& $xmlrpcval->structmem('header');
|
||||
|
||||
$numfields = $header->structmem('fieldcount');
|
||||
$numfields = $numfields->scalarval();
|
||||
$numrecords = $header->structmem('recordcount');
|
||||
$numrecords = $numrecords->scalarval();
|
||||
$sqlstring = $header->structmem('sql');
|
||||
$sqlstring = $sqlstring->scalarval();
|
||||
|
||||
$fieldinfo =& $header->structmem('fieldinfo');
|
||||
for ($i = 0; $i < $numfields; $i++) {
|
||||
$temp =& $fieldinfo->arraymem($i);
|
||||
$fld = new ADOFieldObject();
|
||||
while (list($key,$value) = $temp->structeach()) {
|
||||
if ($key == "name") $fld->name = $value->scalarval();
|
||||
if ($key == "type") $fld->type = $value->scalarval();
|
||||
if ($key == "max_length") $fld->max_length = $value->scalarval();
|
||||
if ($key == "not_null") $fld->not_null = $value->scalarval();
|
||||
if ($key == "has_default") $fld->has_default = $value->scalarval();
|
||||
if ($key == "default_value") $fld->default_value = $value->scalarval();
|
||||
} // while
|
||||
$fields_array[] = $fld;
|
||||
} // for
|
||||
|
||||
// fetch recordset information into php array
|
||||
$body =& $xmlrpcval->structmem('body');
|
||||
for ($i = 0; $i < $numrecords; $i++) {
|
||||
$data_array[$i]= array();
|
||||
$xmlrpcrs_row =& $body->arraymem($i);
|
||||
for ($j = 0; $j < $numfields; $j++) {
|
||||
$temp =& $xmlrpcrs_row->arraymem($j);
|
||||
$data_array[$i][$j] = $temp->scalarval();
|
||||
} // for j
|
||||
} // for i
|
||||
|
||||
// finally build in-memory recordset object and return it
|
||||
$rs = new ADORecordSet_array();
|
||||
$rs->InitArrayFields($data_array,$fields_array);
|
||||
return $rs;
|
||||
|
||||
}
|
||||
|
||||
?>
|