Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PubliS2low
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Damien DEMPT
PubliS2low
Commits
2815a550
Commit
2815a550
authored
3 years ago
by
Damien DEMPT
Browse files
Options
Downloads
Patches
Plain Diff
Update import.php
parent
01788af4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
import.php
+43
-16
43 additions, 16 deletions
import.php
with
43 additions
and
16 deletions
import.php
+
43
−
16
View file @
2815a550
...
...
@@ -8,6 +8,15 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"style/style.css"
>
<body>
<?php
/*
// A faire //
// Récupération de la classification via :
$json=go_curl($insee, URL."/modules/actes/actes_classification_fetch.php", "class.json"); // OK
*/
ini_set
(
'display_errors'
,
'on'
);
error_reporting
(
E_ALL
);
...
...
@@ -38,14 +47,21 @@ else
$insee
=
$_GET
[
'insee'
];
// Prise en compte du serveur Windows
if
(
strtoupper
(
substr
(
PHP_OS
,
0
,
3
))
===
'WIN'
)
{
define
(
'PEM'
,
realpath
(
'key'
)
.
'\\'
.
$cert
.
'client.pem'
);
define
(
'SSLKEY'
,
realpath
(
'key'
)
.
'\\'
.
$cert
.
'key.pem'
);
define
(
'CA_PATH'
,
realpath
(
'key'
)
.
'\\'
.
$cert
.
'ca.pem'
);
}
else
{
// la partie x509 du certificat : openssl pkcs12 -in certificat.p12 -out client.pem -clcerts -nokeys
define
(
'PEM'
,
'./key/'
.
$cert
.
'client.pem'
);
// la clé privée du certificat : openssl pkcs12 -in certificat.p12 -out key.pem -nocerts
define
(
'SSLKEY'
,
'./key/'
.
$cert
.
'key.pem'
);
//le certificat du CA : openssl pkcs12 -in certificat.p12 -out ca.pem -cacerts -nokeys
define
(
'CA_PATH'
,
'./key/'
.
$cert
.
'ca.pem'
);
}
// la partie x509 du certificat : openssl pkcs12 -in certificat.p12 -out client.pem -clcerts -nokeys
define
(
'PEM'
,
'./key/'
.
$cert
.
'client.pem'
);
// la clé privée du certificat : openssl pkcs12 -in certificat.p12 -out key.pem -nocerts
define
(
'SSLKEY'
,
'./key/'
.
$cert
.
'key.pem'
);
//le certificat du CA : openssl pkcs12 -in certificat.p12 -out ca.pem -cacerts -nokeys
define
(
'CA_PATH'
,
'./key/'
.
$cert
.
'ca.pem'
);
// Mot de passe choisi lors de la création openssl
define
(
'PASSWORD'
,
$pass
);
...
...
@@ -81,11 +97,20 @@ else
$sql
=
"SELECT * FROM "
.
$pref_tab
.
"user WHERE actif=1
$w
"
;
$res
=
mysqli_query
(
$link
,
$sql
);
//echo $sql;
while
(
$row
=
mysqli_fetch_object
(
$res
))
{
echo
'<h2>Recherche des actes pour '
.
$row
->
insee
.
'...</h2>'
;
$insee
=
$row
->
insee
;
$user_delib
=
$row
;
load
(
$insee
);
// Lance la récupération des actes
if
(
mysqli_num_rows
(
$res
)
==
0
)
{
// S'il n'y a aucun utilisateur,
// on considère que le certification est pour un usage individuel.
// Il est conseiller de créer au moins 1 utilisateur
// et de spécifier un mot de passe dans S2low.
echo
'<div class="info info-rouge">Vous n\'avez pas défini d\'utilisateur dans la table'
.
$pref_tab
.
'user</div>'
;
//load(''); // Lance la récupération des actes pour l'utilisateur unique => déconseiller
}
else
{
while
(
$row
=
mysqli_fetch_object
(
$res
))
{
echo
'<h2>Recherche des actes pour '
.
$row
->
insee
.
'...</h2>'
;
$insee
=
$row
->
insee
;
$user_delib
=
$row
;
load
(
$insee
);
// Lance la récupération des actes
}
}
...
...
@@ -94,7 +119,7 @@ while ($row=mysqli_fetch_object($res)) {
/* Récupération des actes */
/**************************/
function
load
(
$insee
)
{
global
$pref_tab
;
$nb_load
=
0
;
...
...
@@ -124,8 +149,9 @@ function load($insee) {
if
(
$json
!=
''
)
{
$json
=
json_decode
(
$json
);
foreach
(
$json
->
transactions
as
$k
=>
$t
)
{
echo
"<
b
r>
$t->nature_descr
"
;
echo
"<
h
r>
$t->nature_descr
"
;
echo
$t
->
number
;
//print_r($t);
if
(
$t
->
type
==
1
)
{
// Acte non supprimé
if
(
!
in_array
(
$t
->
id
,
$vu
))
{
// Vérifie si l'acte est déjà récupéré à partir du fichier vu.txt
$nb_load
++
;
...
...
@@ -162,7 +188,7 @@ function load($insee) {
echo
" => DEJA VU !!!"
;
}
}
else
{
// Acte supprimé, donc il sera enlevé de la base
echo
"<h3>TYPE = "
.
$t
->
number
.
" *
"
.
$t
->
type
.
"</h3>"
;
echo
"<h3>TYPE = "
.
$t
->
type
.
" Num :
"
.
$t
->
id
.
"</h3>"
;
foreach
(
glob
(
"actes/"
.
$insee
.
"/*-"
.
$t
->
number
.
"-*.*"
)
as
$nf
)
{
echo
"<br>Supprimer "
.
$nf
;
}
...
...
@@ -233,7 +259,7 @@ function go_curl($user, $api, $nfich='') {
if
(
$curl_return
===
false
)
{
echo
'<div class="info info-rouge">⚠️ Erreur dans le module curl'
;
echo
'<br>curl_errno = '
.
curl_errno
(
$ch
)
.
' ( '
.
curl_error
(
$ch
)
.
' )</div>'
;
$curl_return
=
""
;
$curl_return
=
''
;
}
else
{
if
(
$nfich
!=
''
)
{
// Fichiers déposés dans le dossier actes/
...
...
@@ -241,7 +267,8 @@ function go_curl($user, $api, $nfich='') {
$curl_return
=
''
;
}
}
curl_close
(
$ch
);
curl_close
(
$ch
);
return
(
$curl_return
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment