Skip to content
GitLab
Explore
Sign in
Register
Mladen B.
ISPConfig 3
Compare revisions
19b24c6320d135350ad332d60dbe4a89192d2991 to 7d30386fe3e0aae351e2f61955402e6e188561e3
Show whitespace changes
Inline
Side-by-side
interface/lib/classes/system.inc.php
View file @
7d30386f
...
...
@@ -33,6 +33,7 @@ class system {
var
$client_service
=
null
;
private
$_last_exec_out
=
null
;
private
$_last_exec_retcode
=
null
;
private
$server_count
=
null
;
public
function
has_service
(
$userid
,
$service
)
{
global
$app
;
...
...
@@ -79,6 +80,32 @@ class system {
return
false
;
}
function
rmdir
(
$path
,
$recursive
=
false
)
{
// Disallow operating on root directory
if
(
realpath
(
$path
)
==
'/'
)
{
$app
->
log
(
"rmdir: afraid I might delete root:
$path
"
,
LOGLEVEL_WARN
);
return
false
;
}
$path
=
rtrim
(
$path
,
'/'
);
if
(
is_dir
(
$path
)
&&
!
is_link
(
$path
))
{
$objects
=
array_diff
(
scandir
(
$path
),
array
(
'.'
,
'..'
));
foreach
(
$objects
as
$object
)
{
if
(
$recursive
)
{
if
(
is_dir
(
"
$path
/
$object
"
)
&&
!
is_link
(
"
$path
/
$object
"
))
{
$this
->
rmdir
(
"
$path
/
$object
"
,
$recursive
);
}
else
{
unlink
(
"
$path
/
$object
"
);
}
}
else
{
$app
->
log
(
"rmdir: invoked non-recursive, not removing
$path
(expect rmdir failure)"
,
LOGLEVEL_DEBUG
);
}
}
return
rmdir
(
$path
);
}
return
false
;
}
public
function
last_exec_out
()
{
return
$this
->
_last_exec_out
;
}
...
...
interface/lib/classes/tform_base.inc.php
View file @
7d30386f
...
...
@@ -276,7 +276,8 @@ class tform_base {
unset
(
$tmp_recordid
);
$querystring
=
str_replace
(
"
{
AUTHSQL
}
"
,
$this
->
getAuthSQL
(
'r'
),
$querystring
);
$querystring
=
preg_replace_callback
(
'@{AUTHSQL::(.+?)}@'
,
create_function
(
'$matches'
,
'global $app; $tmp = $app->tform->getAuthSQL("r", $matches[1]); return $tmp;'
),
$querystring
);
//$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', create_function('$matches','global $app; $tmp = $app->tform->getAuthSQL("r", $matches[1]); return $tmp;'), $querystring);
$querystring
=
preg_replace_callback
(
'@{AUTHSQL::(.+?)}@'
,
function
(
$matches
)
{
global
$app
;
$tmp
=
$app
->
tform
->
getAuthSQL
(
"r"
,
$matches
[
1
]);
return
$tmp
;},
$querystring
);
// Getting the records
$tmp_records
=
$app
->
db
->
queryAllRecords
(
$querystring
);
...
...
@@ -1584,7 +1585,7 @@ class tform_base {
// Set form title
$form_hint
=
$this
->
lng
(
$this
->
formDef
[
"title"
]);
if
(
$this
->
formDef
[
"description"
]
!=
''
)
$form_hint
.
=
'<div class="pageForm_description">'
.
$this
->
lng
(
$this
->
formDef
[
"description"
])
.
'</div>'
;
if
(
isset
(
$this
->
formDef
[
"description"
])
&&
$this
->
formDef
[
"description"
]
!=
''
)
$form_hint
.
=
'<div class="pageForm_description">'
.
$this
->
lng
(
$this
->
formDef
[
"description"
])
.
'</div>'
;
$app
->
tpl
->
setVar
(
'form_hint'
,
$form_hint
);
// Set Wordbook for this form
...
...
interface/lib/classes/tpl.inc.php
View file @
7d30386f
...
...
@@ -1121,7 +1121,7 @@ if (!defined('vlibTemplateClassLoaded')) {
{
array_push
(
$this
->
_namespace
,
$varname
);
$tempvar
=
count
(
$this
->
_namespace
)
-
1
;
$retstr
=
"for (
\$
_"
.
$tempvar
.
"=0 ;
\$
_"
.
$tempvar
.
" < count(
\$
this->_arrvars"
;
$retstr
=
"for (
\$
_"
.
$tempvar
.
"=0 ;
\$
_"
.
$tempvar
.
" <
\$
this->_tpl_
count(
\$
this->_arrvars"
;
for
(
$i
=
0
;
$i
<
count
(
$this
->
_namespace
);
$i
++
)
{
$retstr
.
=
"['"
.
$this
->
_namespace
[
$i
]
.
"']"
;
if
(
$this
->
_namespace
[
$i
]
!=
$varname
)
$retstr
.
=
"[
\$
_"
.
$i
.
"]"
;
...
...
@@ -1461,6 +1461,27 @@ if (!defined('vlibTemplateClassLoaded')) {
return
$return
;
}
/**
* Used during in evaled code to replace PHP count function for PHP 8 compatibility
* @var variable to be counted
*/
private
function
_tpl_count
(
$var
)
{
$retvar
=
0
;
if
(
isset
(
$var
))
{
if
(
is_array
(
$var
))
{
$retvar
=
count
(
$var
);
}
elseif
(
is_null
(
$var
))
{
$retvar
=
0
;
}
else
{
$retvar
=
1
;
}
}
else
{
$retvar
=
0
;
}
return
$retvar
;
}
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following functions have no use and are included just so that if the user
is making use of vlibTemplateCache functions, this doesn't crash when changed to
...
...
interface/lib/classes/validate_client.inc.php
View file @
7d30386f
...
...
@@ -175,7 +175,8 @@ class validate_client {
}
}
try
{
$client
=
new
SoapClient
(
"http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
);
ini_set
(
"default_socket_timeout"
,
5
);
$client
=
new
SoapClient
(
"http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
,
array
(
'connection_timeout'
=>
5
));
$params
=
array
(
'countryCode'
=>
$cc
,
'vatNumber'
=>
$vn
);
try
{
$r
=
$client
->
checkVat
(
$params
);
...
...
interface/lib/classes/validate_datetime.inc.php
View file @
7d30386f
...
...
@@ -42,7 +42,7 @@ class validate_datetime
{
if
(
is_array
(
$field_value
)
&&
count
(
$field_value
)
>=
5
)
{
$result
=
array_filter
(
$field_value
,
create_
function
(
'
$dt_unit
'
,
'
return ($dt_unit > 0);
'
)
);
$result
=
array_filter
(
$field_value
,
function
(
$dt_unit
)
{
return
(
$dt_unit
>
0
);
}
);
return
count
(
$result
)
!==
0
;
}
...
...
@@ -86,7 +86,7 @@ class validate_datetime
{
if
(
!
is_array
(
$field_value
))
return
0
;
$second
=
0
;
$filtered_values
=
array_map
(
create_
function
(
'
$item
'
,
'
return (int)$item;
'
)
,
$field_value
);
$filtered_values
=
array_map
(
function
(
$item
)
{
return
(
int
)
$item
;
}
,
$field_value
);
extract
(
$filtered_values
,
EXTR_OVERWRITE
);
return
mktime
(
$hour
,
$minute
,
$second
,
$month
,
$day
,
$year
);
...
...
interface/lib/classes/validate_mail_relay_domain.inc.php
0 → 100644
View file @
7d30386f
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
Copyright (c) 2021, Jesse Norell <jesse@kci.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class
validate_mail_relay_domain
{
function
get_error
(
$errmsg
)
{
global
$app
;
if
(
isset
(
$app
->
tform
->
wordbook
[
$errmsg
]))
{
return
$app
->
tform
->
wordbook
[
$errmsg
]
.
"<br>
\r\n
"
;
}
else
{
return
$errmsg
.
"<br>
\r\n
"
;
}
}
/* Validator function for checking the 'domain' of a mail relay domain */
function
validate_domain
(
$field_name
,
$field_value
,
$validator
)
{
global
$app
,
$conf
;
if
(
isset
(
$app
->
remoting_lib
->
primary_id
))
{
$id
=
$app
->
remoting_lib
->
primary_id
;
}
else
{
$id
=
$app
->
tform
->
primary_id
;
}
// mail_relay_domain.domain must be unique per server
$sql
=
"SELECT relay_domain_id, domain FROM mail_relay_domain WHERE domain = ? AND server_id = ? AND relay_domain_id != ?"
;
$domain_check
=
$app
->
db
->
queryOneRecord
(
$sql
,
$field_value
,
$app
->
tform_actions
->
dataRecord
[
'server_id'
],
$id
);
if
(
$domain_check
)
return
$this
->
get_error
(
'domain_error_unique'
);
}
}
interface/lib/compatibility.inc.php
0 → 100644
View file @
7d30386f
<?php
/*
Copyright (c) 2021, Jesse Norell <jesse@kci.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* random_bytes can be dropped when php 5.6 support is dropped */
if
(
!
function_exists
(
'random_bytes'
))
{
function
random_bytes
(
$length
)
{
return
openssl_random_pseudo_bytes
(
$length
);
}
}
/* random_int can be dropped when php 5.6 support is dropped */
if
(
!
function_exists
(
'random_int'
))
{
function
random_int
(
$min
=
null
,
$max
=
null
)
{
if
(
null
===
$min
)
{
$min
=
PHP_INT_MIN
;
}
if
(
null
===
$max
)
{
$min
=
PHP_INT_MAX
;
}
if
(
!
is_int
(
$min
)
||
!
is_int
(
$max
))
{
trigger_error
(
'random_int: $min and $max must be integer values'
,
E_USER_NOTICE
);
$min
=
(
int
)
$min
;
$max
=
(
int
)
$max
;
}
if
(
$min
>
$max
)
{
trigger_error
(
'random_int: $max can\'t be lesser than $min'
,
E_USER_WARNING
);
return
null
;
}
$range
=
$counter
=
$max
-
$min
;
$bits
=
1
;
while
(
$counter
>>=
1
)
{
++
$bits
;
}
$bytes
=
(
int
)
max
(
ceil
(
$bits
/
8
),
1
);
$bitmask
=
pow
(
2
,
$bits
)
-
1
;
if
(
$bitmask
>=
PHP_INT_MAX
)
{
$bitmask
=
PHP_INT_MAX
;
}
do
{
$result
=
hexdec
(
bin2hex
(
random_bytes
(
$bytes
)))
&
$bitmask
;
}
while
(
$result
>
$range
);
return
$result
+
$min
;
}
}
interface/lib/config.inc.php
View file @
7d30386f
...
...
@@ -46,7 +46,7 @@ $revision = str_replace(array('Revision:', '$', ' '), '', $svn_revision);
//** Application
define
(
'ISPC_APP_TITLE'
,
'ISPConfig'
);
define
(
'ISPC_APP_VERSION'
,
'3.2dev'
);
define
(
'DEVSYSTEM'
,
0
);
define
(
'DEVSYSTEM'
,
false
);
//** Database
...
...
@@ -159,4 +159,7 @@ define('LOGLEVEL_DEBUG', 0);
define
(
'LOGLEVEL_WARN'
,
1
);
define
(
'LOGLEVEL_ERROR'
,
2
);
//** Admin IP whitelist file
$conf
[
'admin_ip_whitelist_file'
]
=
'/usr/local/ispconfig/security/admin_ip.whitelist'
;
?>
interface/lib/lang/ar.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Delete XMPP user';
$wb
[
'unlimited_txt'
]
=
'Unlimited'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/bg.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Изтрий XMPP потребител';
$wb
[
'unlimited_txt'
]
=
'Неограничен'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/br.lng
View file @
7d30386f
...
...
@@ -172,3 +172,6 @@ $wb['select_master_directive_snippet_txt'] = 'Diretiva mestre de trechos de cód
$wb
[
'unlimited_txt'
]
=
'Ilimitado'
;
$wb
[
'server_id_0_error_txt'
]
=
'Por favor, selecione um servidor válido. O ID do servidor deve ser > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Fechar'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/ca.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Delete XMPP user';
$wb
[
'unlimited_txt'
]
=
'Illimité'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/cz.lng
View file @
7d30386f
...
...
@@ -172,3 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Smazat XMPP uživatele';
$wb
[
'unlimited_txt'
]
=
'Neomezený'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/de.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['select_master_directive_snippet_txt'] = 'Master Direktiven Schnipsel';
$wb
[
'unlimited_txt'
]
=
'unlimitiert'
;
$wb
[
'server_id_0_error_txt'
]
=
'Bitte Server auswählen. Server ID muss > als 0 sein.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/dk.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Delete XMPP user';
$wb
[
'unlimited_txt'
]
=
'Ubegrænset'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/el.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Delete XMPP user';
$wb
[
'unlimited_txt'
]
=
'Απεριόριστα'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/en.lng
View file @
7d30386f
...
...
@@ -173,4 +173,6 @@ $wb['select_master_directive_snippet_txt'] = 'Master Directive Snippets';
$wb
[
'unlimited_txt'
]
=
'Unlimited'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/es.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Borrar usuario XMPP';
$wb
[
'unlimited_txt'
]
=
'Ilimitado'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Cerrar'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/fi.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Delete XMPP user';
$wb
[
'unlimited_txt'
]
=
'Unlimited'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
interface/lib/lang/fr.lng
View file @
7d30386f
...
...
@@ -172,4 +172,6 @@ $wb['datalog_status_d_xmpp_user'] = 'Delete XMPP user';
$wb
[
'unlimited_txt'
]
=
'Illimité'
;
$wb
[
'server_id_0_error_txt'
]
=
'Please select a valid Server. Server ID must be > 0.'
;
$wb
[
'datalog_changes_close_txt'
]
=
'Close'
;
$wb
[
'non_admin_error'
]
=
'Requires administrator level permissions'
;
$wb
[
'copy_to_clipboard_txt'
]
=
'Copy to clipboard'
;
?>
Prev
1
2
3
4
5
6
7
8
9
…
39
Next