Add new tool System Info

This commit is contained in:
champsupertramp
2016-08-04 18:36:26 +08:00
parent 10e3e8263a
commit 2128a96942
4 changed files with 1499 additions and 0 deletions
+1103
View File
File diff suppressed because it is too large Load Diff
+71
View File
@@ -1743,4 +1743,75 @@ function um_fetch_user( $user_id ) {
|| substr($_SERVER['HTTP_HOST'],0,3) == '10.'
|| substr($_SERVER['HTTP_HOST'],0,7) == '192.168') return true;
return false;
}
/**
* Get user host
*
* Returns the webhost this site is using if possible
*
* @since 1.3.68
* @return mixed string $host if detected, false otherwise
*/
function um_get_host() {
$host = false;
if( defined( 'WPE_APIKEY' ) ) {
$host = 'WP Engine';
} elseif( defined( 'PAGELYBIN' ) ) {
$host = 'Pagely';
} elseif( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
$host = 'ICDSoft';
} elseif( DB_HOST == 'mysqlv5' ) {
$host = 'NetworkSolutions';
} elseif( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
$host = 'iPage';
} elseif( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
$host = 'IPower';
} elseif( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
$host = 'MediaTemple Grid';
} elseif( strpos( DB_HOST, '.pair.com' ) !== false ) {
$host = 'pair Networks';
} elseif( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
$host = 'Rackspace Cloud';
} elseif( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
$host = 'SysFix.eu Power Hosting';
} elseif( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
$host = 'Flywheel';
} else {
// Adding a general fallback for data gathering
$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
}
return $host;
}
/**
* Let To Num
*
* Does Size Conversions
*
* @since 1.3.68
* @author Chris Christoff
*
* @param unknown $v
* @return int|string
*/
function um_let_to_num( $v ) {
$l = substr( $v, -1 );
$ret = substr( $v, 0, -1 );
switch ( strtoupper( $l ) ) {
case 'P': // fall-through
case 'T': // fall-through
case 'G': // fall-through
case 'M': // fall-through
case 'K': // fall-through
$ret *= 1024;
break;
default:
break;
}
return $ret;
}