Move unparse_url from add_monitors to functions to make it generally available
This commit is contained in:
parent
04eef58883
commit
f9d8c349e1
|
@ -1,23 +1,4 @@
|
|||
<?php
|
||||
function unparse_url($parsed_url, $substitutions = array() ) {
|
||||
$fields = array('scheme','host','port','user','pass','path','query','fragment');
|
||||
|
||||
foreach ( $fields as $field ) {
|
||||
if ( isset( $substitutions[$field] ) ) {
|
||||
$parsed_url[$field] = $substitutions[$field];
|
||||
}
|
||||
}
|
||||
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
|
||||
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
|
||||
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
|
||||
$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
|
||||
$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
|
||||
$pass = ($user || $pass) ? "$pass@" : '';
|
||||
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
|
||||
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
|
||||
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
||||
return "$scheme$user$pass$host$port$path$query$fragment";
|
||||
}
|
||||
|
||||
$defaultMonitor = new Monitor();
|
||||
$defaultMonitor->set(array(
|
||||
|
|
|
@ -841,6 +841,7 @@ function daemonControl( $command, $daemon=false, $args=false ) {
|
|||
}
|
||||
$string = escapeshellcmd( $string );
|
||||
#$string .= ' 2>/dev/null >&- <&- >/dev/null';
|
||||
Logger::Debug("daemonControl $string");
|
||||
exec( $string );
|
||||
}
|
||||
|
||||
|
@ -2314,4 +2315,23 @@ function csrf_startup() {
|
|||
csrf_conf('rewrite-js', 'includes/csrf/csrf-magic.js');
|
||||
}
|
||||
|
||||
function unparse_url($parsed_url, $substitutions = array() ) {
|
||||
$fields = array('scheme','host','port','user','pass','path','query','fragment');
|
||||
|
||||
foreach ( $fields as $field ) {
|
||||
if ( isset( $substitutions[$field] ) ) {
|
||||
$parsed_url[$field] = $substitutions[$field];
|
||||
}
|
||||
}
|
||||
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
|
||||
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
|
||||
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
|
||||
$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
|
||||
$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
|
||||
$pass = ($user || $pass) ? "$pass@" : '';
|
||||
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
|
||||
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
|
||||
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
||||
return "$scheme$user$pass$host$port$path$query$fragment";
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue