Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
domainepublic
alternc
Commits
7a34227c
Commit
7a34227c
authored
Feb 07, 2013
by
Benjamin Sonntag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use empty() to check array's key existence, Fixes #1418
parent
b6fe519a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
21 deletions
+31
-21
roundcube/class/m_roundcube.php
roundcube/class/m_roundcube.php
+15
-10
squirrelmail/class/m_squirrelmail.php
squirrelmail/class/m_squirrelmail.php
+16
-11
No files found.
roundcube/class/m_roundcube.php
View file @
7a34227c
...
...
@@ -40,16 +40,21 @@ class m_roundcube {
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i
=
2
;
$domain
=
""
;
do
{
// for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
list
(
$host
,
$dompart
)
=
explode
(
"."
,
$_SERVER
[
"HTTP_HOST"
],
$i
);
// We search for a 'roundcube' subdomain in that domain
$db
->
query
(
"SELECT * FROM sub_domaines s WHERE s.domaine='"
.
addslashes
(
$dompart
)
.
"' AND s.type='roundcube';"
);
if
(
$db
->
next_record
())
{
$domain
=
$db
->
Record
;
return
"http://"
.
$domain
[
"sub"
]
.
((
$domain
[
"sub"
])
?
"."
:
""
)
.
$domain
[
"domaine"
];
}
$i
++
;
}
while
(
strpos
(
$dompart
,
'.'
)
!==
false
);
if
(
!
empty
(
$_SERVER
[
"HTTP_HOST"
]))
{
do
{
// for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
$expl
=
explode
(
"."
,
$_SERVER
[
"HTTP_HOST"
],
$i
);
if
(
count
(
$expl
)
>=
2
)
{
list
(
$host
,
$dompart
)
=
$expl
;
// We search for a 'squirrelmail' subdomain in that domain
$db
->
query
(
"SELECT * FROM sub_domaines s WHERE s.domaine='"
.
addslashes
(
$dompart
)
.
"' AND s.type='roundcube';"
);
if
(
$db
->
next_record
())
{
$domain
=
$db
->
Record
;
return
"http://"
.
$domain
[
"sub"
]
.
((
$domain
[
"sub"
])
?
"."
:
""
)
.
$domain
[
"domaine"
];
}
}
$i
++
;
}
while
(
strpos
(
$dompart
,
'.'
)
!==
false
);
}
// not found: search for a webmail in the admin user account
$db
->
query
(
"SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='roundcube';"
);
...
...
squirrelmail/class/m_squirrelmail.php
View file @
7a34227c
...
...
@@ -40,17 +40,22 @@ class m_squirrelmail {
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i
=
2
;
$domain
=
""
;
do
{
// for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
list
(
$host
,
$dompart
)
=
explode
(
"."
,
$_SERVER
[
"HTTP_HOST"
],
$i
);
// We search for a 'squirrelmail' subdomain in that domain
$db
->
query
(
"SELECT * FROM sub_domaines s WHERE s.domaine='"
.
addslashes
(
$dompart
)
.
"' AND s.type='squirrelmail';"
);
if
(
$db
->
next_record
())
{
$domain
=
$db
->
Record
;
return
"http://"
.
$domain
[
"sub"
]
.
((
$domain
[
"sub"
])
?
"."
:
""
)
.
$domain
[
"domaine"
];
}
$i
++
;
}
while
(
strpos
(
$dompart
,
'.'
)
!==
false
);
if
(
!
empty
(
$_SERVER
[
"HTTP_HOST"
]))
{
do
{
// for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
$expl
=
explode
(
"."
,
$_SERVER
[
"HTTP_HOST"
],
$i
);
if
(
count
(
$expl
)
>=
2
)
{
list
(
$host
,
$dompart
)
=
$expl
;
// We search for a 'squirrelmail' subdomain in that domain
$db
->
query
(
"SELECT * FROM sub_domaines s WHERE s.domaine='"
.
addslashes
(
$dompart
)
.
"' AND s.type='squirrelmail';"
);
if
(
$db
->
next_record
())
{
$domain
=
$db
->
Record
;
return
"http://"
.
$domain
[
"sub"
]
.
((
$domain
[
"sub"
])
?
"."
:
""
)
.
$domain
[
"domaine"
];
}
}
$i
++
;
}
while
(
strpos
(
$dompart
,
'.'
)
!==
false
);
}
// not found: search for a webmail in the admin user account
$db
->
query
(
"SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='squirrelmail';"
);
if
(
$db
->
next_record
())
{
...
...
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