Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dpsite2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
domainepublic
dpsite2
Commits
1f6fb2ed
Commit
1f6fb2ed
authored
Sep 17, 2017
by
Pierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webmail mieux
parent
2548d288
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
18 deletions
+27
-18
squelettes/formulaires/webmail.php
squelettes/formulaires/webmail.php
+10
-6
squelettes/mes_fonctions.php
squelettes/mes_fonctions.php
+17
-12
No files found.
squelettes/formulaires/webmail.php
View file @
1f6fb2ed
...
...
@@ -30,6 +30,7 @@ function formulaires_webmail_charger_dist(){
function
formulaires_webmail_verifier_dist
(){
$erreurs
=
array
();
$webmail
=
_request
(
'webmail'
);
spip_log
(
"adresse email : "
.
$webmail
,
'test'
.
_LOG_AVERTISSEMENT
);
$tableau_email
=
explode
(
"@"
,
$webmail
);
// pas de @ ? = invalide
if
(
!
isset
(
$tableau_email
[
1
]))
...
...
@@ -38,22 +39,25 @@ function formulaires_webmail_verifier_dist(){
else
if
(
filter_var
(
$webmail
,
FILTER_VALIDATE_EMAIL
)
!==
false
){
$domaine
=
$tableau_email
[
1
];
// juste le nom de domaine
$serveur
=
webmail_dp
(
$domaine
);
// serveur MX ?
spip_log
(
"domaine "
.
$domaine
,
'test'
.
_LOG_AVERTISSEMENT
);
spip_log
(
"serveur "
.
$serveur
,
'test'
.
_LOG_AVERTISSEMENT
);
if
(
$serveur
!=
"mx.domainepublic.net"
)
//
spip_log("domaine ".$domaine,'test'._LOG_AVERTISSEMENT);
//
spip_log("serveur ".$serveur,'test'._LOG_AVERTISSEMENT);
if
(
$serveur
AND
$serveur
!=
"mx.domainepublic.net"
)
set_request
(
"serveur"
,
"http://mail."
.
$domaine
.
"?_user="
.
$webmail
);
else
else
if
(
$serveur
)
set_request
(
"serveur"
,
"http://mail.domainepublic.net?_user="
.
$webmail
);
spip_log
(
"serveur mail "
.
_request
(
"serveur"
),
'test'
.
_LOG_AVERTISSEMENT
);
}
// si la fonction php mx_chez_dp ne retourne rien
if
(
!
$serveur
){
spip_log
(
"serveur mail : "
,
'test'
.
_LOG_AVERTISSEMENT
);
$erreurs
[
'webmail'
]
=
"Adresse email invalide"
;
}
// CHEZ DP ?
if
(
!
$erreurs
[
'webmail'
]
AND
!
match
(
$serveur
,
'domainepublic.net'
)){
else
if
(
!
$erreurs
[
'webmail'
]
AND
!
match
(
$serveur
,
'domainepublic.net'
)){
spip_log
(
"serveur mail : "
,
'test'
.
_LOG_AVERTISSEMENT
);
$erreurs
[
'webmail'
]
=
"Cette adresse email n'est pas hébergée par domainepublic"
;
}
else
spip_log
(
"serveur mail : "
.
_request
(
"serveur"
),
'test'
.
_LOG_AVERTISSEMENT
);
return
$erreurs
;
}
...
...
squelettes/mes_fonctions.php
View file @
1f6fb2ed
...
...
@@ -10,7 +10,8 @@
* retourne false
*/
function
cloud_dp
(
$domaine
)
{
spip_log
(
"cloud_dp arg : "
.
$domaine
,
'test'
.
_LOG_AVERTISSEMENT
);
spip_log
(
"Cloud demande : "
.
$domaine
,
'test'
.
_LOG_AVERTISSEMENT
);
// spip_log("cloud_dp arg : ".$domaine,'test'._LOG_AVERTISSEMENT);
$retour
=
array
();
// $domaine_initial = $domaine ;
if
(
filter_var
(
$domaine
,
FILTER_VALIDATE_EMAIL
)
!==
false
){
...
...
@@ -51,7 +52,7 @@ function cloud_dp ($domaine) {
}
// spip_log("bureau_dp ".$serveur_site,'test'._LOG_AVERTISSEMENT);
$result
=
dns_get_record
(
$domaine
,
DNS_A
);
spip_log
(
"dns_get_record "
.
print_r
(
$result
,
1
),
'test'
.
_LOG_AVERTISSEMENT
);
//
spip_log("dns_get_record ".print_r($result,1),'test'._LOG_AVERTISSEMENT);
// spip_log("pageTitle ".pageTitle("http://".$result[0]['host']),'test'._LOG_AVERTISSEMENT);
// on checke si page titre contient cloud ???
...
...
@@ -64,12 +65,12 @@ function cloud_dp ($domaine) {
else
if
(
(
!
match
(
$result
[
0
][
'host'
],
'cloud'
))
AND
$retour
[
"chez_dp"
]){
// spip_log("essai "."cloud.".$result[0]['host'],'test'._LOG_AVERTISSEMENT);
$result
=
dns_get_record
(
"cloud."
.
$result
[
0
][
'host'
],
DNS_A
);
spip_log
(
"dns_get_record2 "
.
print_r
(
$result
,
1
),
'test'
.
_LOG_AVERTISSEMENT
);
//
spip_log("dns_get_record2 ".print_r($result,1),'test'._LOG_AVERTISSEMENT);
$serveur
=
$result
[
0
][
'ip'
];
// On obtient le nom de domaine de l'adress IP
if
(
$serveur
){
$serveur_essai
=
gethostbyaddr
(
$serveur
);
spip_log
(
"serveur essai "
.
$serveur_essai
,
'test'
.
_LOG_AVERTISSEMENT
);
//
spip_log("serveur essai ".$serveur_essai,'test'._LOG_AVERTISSEMENT);
if
(
strlen
(
$serveur_essai
)
AND
(
$serveur_essai
!==
"cloud.domainepublic.net"
)
AND
$result
AND
isset
(
$result
[
0
][
'host'
])){
$pageTitre
=
pageTitle
(
"http://"
.
$result
[
0
][
'host'
],
'cloud'
);
// spip_log("pageTitle ".$pageTitre,'test'._LOG_AVERTISSEMENT);
...
...
@@ -81,6 +82,7 @@ function cloud_dp ($domaine) {
}
}
}
spip_log
(
"Cloud serveur : "
.
$retour
[
"serveur"
],
'test'
.
_LOG_AVERTISSEMENT
);
return
$retour
;
}
/**
...
...
@@ -93,6 +95,7 @@ function cloud_dp ($domaine) {
* retourne false
*/
function
bureau_dp
(
$domaine
)
{
spip_log
(
"bureau_dp domaine : "
.
$domaine
,
'test'
.
_LOG_AVERTISSEMENT
);
// spip_log("filter_var ".filter_var($domaine, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED),'test'._LOG_AVERTISSEMENT);
if
(
preg_match
(
"/^(http[s]?\:\/\/)?([-A-Za-z0-9]+\.)+[A-Za-z]
{
2,10
}
$/"
,
$domaine
)){
// spip_log("preg_match ".preg_match("/^(http[s]?\:\/\/)?([-A-Za-z0-9]+\.)+[A-Za-z]{2,10}$/", $domaine),'test'._LOG_AVERTISSEMENT);
...
...
@@ -114,8 +117,10 @@ function bureau_dp ($domaine) {
if
((
$serveur
==
"collectif2.all2all.org"
)
OR
$serveur
==
"ramdam.domainepublic.net"
)
$serveur
=
"bureau.domainepublic.net"
;
// SINON RAMDAM !!! $serveur = "tumulte.domainepublic.net" ou "grabuge.domainepublic.net" etc ...
if
(
$serveur
)
if
(
$serveur
){
spip_log
(
"Bureau serveur : "
.
$serveur
,
'test'
.
_LOG_AVERTISSEMENT
);
return
"http://"
.
$serveur
;
}
}
}
}
...
...
@@ -131,14 +136,14 @@ function bureau_dp ($domaine) {
* renvoie vers 'tumulte.domainepublic.net'
*/
function
webmail_dp
(
$domaine
)
{
spip_log
(
"adress
"
.
$domaine
,
'test'
.
_LOG_AVERTISSEMENT
);
//spip_log("adresse domaine :
".$domaine,'test'._LOG_AVERTISSEMENT);
// return false;
spip_log
(
"domaine "
.
$domaine
,
'test'
.
_LOG_AVERTISSEMENT
);
//
spip_log("domaine ".$domaine,'test'._LOG_AVERTISSEMENT);
$result
=
dns_get_record
(
$domaine
,
DNS_MX
);
spip_log
(
"serveur "
.
print_r
(
$result
,
1
),
'test'
.
_LOG_AVERTISSEMENT
);
//
spip_log("serveur ".print_r($result,1),'test'._LOG_AVERTISSEMENT);
if
(
$result
AND
isset
(
$result
[
0
][
'target'
])){
$serveur
=
$result
[
0
][
'target'
];
spip_log
(
"MX serveur
"
.
$serveur
,
'test'
.
_LOG_AVERTISSEMENT
);
// spip_log("Email serveur :
".$serveur,'test'._LOG_AVERTISSEMENT);
if
(
$serveur
)
return
$serveur
;
}
...
...
@@ -162,11 +167,11 @@ function pageTitle($page_url)
{
$arrContextOptions
=
array
(
"ssl"
=>
array
(
//
"verify_peer"=>false,
//
"verify_peer_name"=>false,
"verify_peer"
=>
false
,
"verify_peer_name"
=>
false
,
),
);
$read_page
=
file_get_contents
(
$page_url
);
$read_page
=
file_get_contents
(
$page_url
,
false
,
stream_context_create
(
$arrContextOptions
)
);
preg_match
(
"/<title.*?>[
\n\r
\s]*(.*)[
\n\r
\s]*<\/title>/"
,
$read_page
,
$page_title
);
if
(
isset
(
$page_title
[
1
]))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment