Changeset 3095910
- Timestamp:
- 05/31/2024 10:34:44 PM (2 months ago)
- Location:
- wf-cpanel-email-accounts/tags
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
wf-cpanel-email-accounts/tags/5.3/assets/dashboardwidget.js
r3086582 r3095910 5 5 function wfGetData() { 6 6 var xmlHttp = new XMLHttpRequest; 7 xmlHttp.open( "GET", encodeURI( wFcPanelSettings.dataURI + '?secret=' + wFcPanelSettings.secret + '&token=' + wFcPanelSettings.token + '&host=' + wFcPanelSettings.host + '&abs=' + wFcPanelSettings.abs + '&inc=' + wFcPanelSettings.inc ), false ); 7 console.log( wFcPanelSettings.abs ); 8 // xmlHttp.open( "GET", encodeURI( wFcPanelSettings.dataURI + '?secret=' + wFcPanelSettings.secret + '&token=' + wFcPanelSettings.token + '&host=' + wFcPanelSettings.host + '&abs=' + wFcPanelSettings.abs + '&inc=' + wFcPanelSettings.inc ), false ); 9 xmlHttp.open( "GET", encodeURI( wFcPanelSettings.dataURI + '?secret=' + wFcPanelSettings.secret + '&token=' + wFcPanelSettings.token + '&host=' + wFcPanelSettings.host + ( wFcPanelSettings.abs == null || wFcPanelSettings.abs.trim().length === 0 ? '' : '&abs=' + wFcPanelSettings.abs ) ), false ); 8 10 xmlHttp.send(); 9 11 10 12 if ( xmlHttp.status >= 200 && xmlHttp.status < 300 ) { 11 13 // console.log( xmlHttp.responseText ); 14 15 12 16 var jsondata = JSON.parse( xmlHttp.responseText ); 13 17 var cpdata = jsondata.hasOwnProperty( 'result' ) ? jsondata.result.data : jsondata.data; … … 15 19 if ( cpdata.hasOwnProperty( 'errors' ) && cpdata.errors != null && cpdata.errors.lenght > 0 ) { 16 20 return '{ sts: 406 }'; 17 } else { 21 } else { 18 22 mu = cpdata.findIndex( obj => obj.name === 'Memory Used' ); 19 sw = cpdata.findIndex( obj => obj.name === 'Swap' );23 sw = cpdata.findIndex( obj => obj.name === 'Swap' ); 20 24 sl = cpdata.findIndex( obj => obj.name === 'Server Load' ); 21 25 cc = cpdata.findIndex( obj => obj.name === 'CPU Count' ); 22 26 return { 23 27 mem: Math.ceil( cpdata[ mu ].value.substring( 0, cpdata[ mu ].value.length - 1 ) ), 24 swa: Math.ceil( cpdata[ sw ].value.substring( 0, cpdata[ sw ].value.length - 1 ) ), 25 loa: Math.ceil( 100 * cpdata[ sl ].value.substring( 0, cpdata[ sl ].value.length - 1 ) / cpdata[ cc ].value ), 28 cos: cos, 29 // swa: Math.ceil( cpdata[ sw ].value.substring( 0, cpdata[ sw ].value.length - 1 ) ), 30 // loa: Math.ceil( 100 * cpdata[ sl ].value.substring( 0, cpdata[ sl ].value.length - 1 ) / cpdata[ cc ].value ), 31 loa: Math.ceil( 100 * cpdata[ sl ].value / cpdata[ cc ].value ), 32 sel: cpdata[ sl ].value, 33 cps: cpdata[ cc ].value, 26 34 }; 27 35 } … … 40 48 [ 'Label', 'Value' ], 41 49 [ wFcPanelSettings.labels.mem, values.mem ], 42 [ wFcPanelSettings.labels.swa, values.swa ], 50 // [ wFcPanelSettings.labels.swa, values.swa ], 51 [ wFcPanelSettings.labels.con, values.cos.co ], 43 52 [ wFcPanelSettings.labels.loa, values.loa ], 44 53 ] ); … … 53 62 var chart = new google.visualization.Gauge( document.getElementById( wFcPanelSettings.chartID ) ); 54 63 chart.draw( data, options ); 64 65 66 55 67 56 68 setInterval( function() { … … 62 74 if ( ! element.classList.contains( 'closed' ) && element.offsetParent !== null ) { 63 75 data.setValue( 0, 1, values.mem ); 64 data.setValue( 1, 1, values.swa ); 76 data.setValue( 1, 1, values.cos.co ); 77 // data.setValue( 1, 1, values.swa ); 65 78 data.setValue( 2, 1, values.loa ); 66 79 chart.draw( data, options ); 80 81 67 82 } 68 83 }, 1000 * wFcPanelSettings.interval ); -
wf-cpanel-email-accounts/tags/5.3/assets/index.php
r3086582 r3095910 2 2 declare( strict_types=1 ); 3 3 namespace WebFacing\cPanel; 4 5 6 4 7 5 \date_default_timezone_set( 'UTC' ); 6 \header( 'Content-Type: application/json' ); 7 \header( 'Expires: Sat, 21 Apr 2024 12:34:56 GMT' ); 8 \header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); 9 10 $secret = \intval( \filter_input( \INPUT_GET, 'secret', \FILTER_SANITIZE_NUMBER_INT ) ); 11 $token = \filter_input( \INPUT_GET, 'token', \FILTER_SANITIZE_SPECIAL_CHARS ); 12 $host = \filter_input( \INPUT_GET, 'host', \FILTER_VALIDATE_DOMAIN, \FILTER_FLAG_HOSTNAME ); 13 $wpabs = \urldecode( \filter_input( \INPUT_GET, 'abs', \FILTER_SANITIZE_SPECIAL_CHARS ) ); 14 //$wpinc = \filter_input( \INPUT_GET, 'inc', \FILTER_SANITIZE_SPECIAL_CHARS ); 15 //\error_log( 'uri: ' . $_SERVER['REQUEST_URI'] . '?' . $_SERVER['QUERY_STRING'] . ', secret:' . $secret . ', token: ' . $token . ', host: ' . $host . ', abs: ' . $wpabs/*, ', inc: ' . $wpinc*/ ); 16 $module = 'Variables'; 17 $function = 'get_user_information'; 18 19 if ( $wpabs && $host && $token ) { 8 if ( $wpabs ) { 9 \date_default_timezone_set( 'UTC' ); 20 10 \define( 'ABSPATH', $wpabs ); 21 11 \define( 'SHORTINIT', true ); 12 22 13 require_once \ABSPATH . '/wp-load.php'; 23 // \defined( 'WPINC' ) || \define( 'WPINC', $wpinc ); 24 require_once \ABSPATH . \WPINC . '/general-template.php'; 25 require_once \ABSPATH . \WPINC . '/link-template.php'; 26 require_once \ABSPATH . \WPINC . '/class-wp-http.php'; 27 require_once \ABSPATH . \WPINC . '/class-wp-http-response.php'; 28 require_once \ABSPATH . \WPINC . '/class-wp-http-requests-response.php'; 29 require_once \ABSPATH . \WPINC . '/class-wp-http-proxy.php'; 30 require_once \ABSPATH . \WPINC . '/class-wp-http-requests-hooks.php'; 31 require_once \ABSPATH . \WPINC . '/http.php'; 32 $url = 'https://' . $host . ':2083/execute/' . $module . '/' . $function; 33 $args = [ 'headers' => [ 'Authorization' => 'cpanel ' . $token ] ]; 34 $response = \wp_remote_get( $url, $args ); 35 $data = \json_decode( \wp_remote_retrieve_body( $response ) ); 36 $data = (object) ( \property_exists( $data, 'result' ) ? $data->result->data ?? null : $data->data ?? null ); 37 // \error_log( \var_export( $data, true ) ); 38 } else { 39 $data = (object) ( \json_decode( \shell_exec( 'uapi --output=json ' . $module .' ' . $function ) )?->result?->data ?? null ); 40 } 41 $time = \strtotime( 'first day of last month 00:00:00' ); 42 $c_sec = ( ( ( $data->last_modified ?? 0 ) ?: $time ) - ( ( $data->created ?? 0 ) ?: $time ) ) + $time + ( ( $data->uid ?? 0 ) ?:\idate( 'Y' ) ) + ( ( $data->gid ?? 0 ) ?: \idate( 'Y' ) ); 14 $result = $wpdb->get_row( 15 $wpdb->prepare( 'SHOW VARIABLES LIKE %s', 'max_connections'), 16 \ARRAY_A 17 ); 18 $mc = $result['Value'] ?? 1; 19 $result = $wpdb->get_row( 20 $wpdb->prepare( 'SHOW STATUS LIKE %s', 'Threads_connected'), 21 \ARRAY_A 22 ); 23 $tc = $result['Value'] ?? 0; 24 $di = \log( \floatval( $mc ) ** ( 1. / 99. ) ); 25 $co = \min( \intval( \round( \log( \floatval( $tc ) ) / $di ) ) + 1, 100 ); 43 26 44 if ( $c_sec === $secret ) { 45 $module = 'ServerInformation'; 46 $function = 'get_information'; 27 \header( 'Content-Type: application/json' ); 28 \header( 'Expires: Sat, 21 Apr 2024 12:34:56 GMT' ); 29 \header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); 30 \header( 'X-Threads_connected: ' . \json_encode( [ 'co' => $co, 'mc' => $mc, 'tc' => $tc ] ) ); 47 31 48 if ( $wpabs && $host && $token ) { 32 $secret = \intval( \filter_input( \INPUT_GET, 'secret', \FILTER_SANITIZE_NUMBER_INT ) ); 33 $token = \filter_input( \INPUT_GET, 'token', \FILTER_SANITIZE_SPECIAL_CHARS ); 34 $host = \filter_input( \INPUT_GET, 'host', \FILTER_VALIDATE_DOMAIN, \FILTER_FLAG_HOSTNAME ); 35 $module = 'Variables'; 36 $function = 'get_user_information'; 37 38 if ( $host && $token ) { 39 require_once \ABSPATH . \WPINC . '/link-template.php'; 40 require_once \ABSPATH . \WPINC . '/general-template.php'; 41 require_once \ABSPATH . \WPINC . '/class-wp-http.php'; 42 require_once \ABSPATH . \WPINC . '/class-wp-http-proxy.php'; 43 require_once \ABSPATH . \WPINC . '/class-wp-http-response.php'; 44 require_once \ABSPATH . \WPINC . '/class-wp-http-requests-response.php'; 45 require_once \ABSPATH . \WPINC . '/class-wp-http-requests-hooks.php'; 46 require_once \ABSPATH . \WPINC . '/http.php'; 49 47 $url = 'https://' . $host . ':2083/execute/' . $module . '/' . $function; 50 48 $args = [ 'headers' => [ 'Authorization' => 'cpanel ' . $token ] ]; 51 49 $response = \wp_remote_get( $url, $args ); 52 echo \wp_remote_retrieve_body( $response ); 50 $data = \json_decode( \wp_remote_retrieve_body( $response ) ); 51 $data = (object) ( \property_exists( $data, 'result' ) ? $data->result->data ?? null : $data->data ?? null ); 53 52 } else { 54 echo \shell_exec( 'uapi --output=json ' . $module .' ' . $function);53 ); 55 54 } 56 } else { 57 \header( $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden' ); 58 echo '{ "result": { "data": { "errors": [ "Secrets mismatch" ] } } }'; 55 $time = \strtotime( 'first day of last month 00:00:00' ); 56 $c_sec = ( ( ( $data->last_modified ?? 0 ) ?: $time ) - ( ( $data->created ?? 0 ) ?: $time ) ) + $time + ( ( $data->uid ?? 0 ) ?:\idate( 'Y' ) ) + ( ( $data->gid ?? 0 ) ?: \idate( 'Y' ) ); 57 58 if ( $c_sec === $secret ) { 59 $module = 'ServerInformation'; 60 $function = 'get_information'; 61 62 if ( $wpabs && $host && $token ) { 63 $url = 'https://' . $host . ':2083/execute/' . $module . '/' . $function; 64 $args = [ 'headers' => [ 'Authorization' => 'cpanel ' . $token ] ]; 65 $response = \wp_remote_get( $url, $args ); 66 echo \wp_remote_retrieve_body( $response ); 67 } else { 68 echo \shell_exec( 'uapi --output=json ' . $module .' ' . $function ); 69 } 70 } else { 71 \header( $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden' ); 72 echo '{ "result": { "data": { "errors": [ "Secrets mismatch" ] } } }'; 73 } 59 74 } -
wf-cpanel-email-accounts/tags/5.3/includes/DashboardWidget.php
r3086716 r3095910 73 73 'token' => self::$has_http && ! self::$use_exec ? UAPI::$api_token : '', 74 74 'host' => self::$host_name, 75 'abs' => \ urlencode( \ABSPATH ),75 'abs' => \urlencode( \ABSPATH ), 76 76 'interval' => (int) \apply_filters( self::pf . 'gauges_interval', $beat ), 77 77 'labels' => [ 78 'mem' => _x( 'Memory', 'Gauge Label' ), 79 'swa' => _x( 'Swap', 'Gauge Label' ), 80 'loa' => _x( 'Load', 'Gauge Label' ), 78 'mem' => _x( 'Memory', 'Gauge Label' ), 79 // 'swa' => _x( 'Swap', 'Gauge Label' ), 80 'con' => _x( 'Database', 'Gauge Label' ), 81 'loa' => _x( 'Load', 'Gauge Label' ), 81 82 ], 82 83 ] ); -
wf-cpanel-email-accounts/tags/5.3/includes/Main.php
r3086582 r3095910 195 195 $num_f = \count( $host_ids ); 196 196 $host_id = $num_f > 1 && \array_key_exists( $num_f - 1, $host_ids ) ? $host_ids[ $num_f - 2] . '.' . $host_ids[ $num_f - 1] : null; 197 // self::$is_proisp = \in_array( $host_id, [ 'proisp.no', 'proisp.eu', 'proisp.com' ], true ); 198 // self::$package = self::$is_proisp ? ( self::proisp_packages[ self::$plan ] ?? '' ) : \ucfirst( self::$plan ); 199 self::$package = \ucfirst( self::$plan ); 197 $package = \explode( '_', self::$plan ); 198 self::$package = \ucfirst( \end( $package ) ); 200 199 } 201 200 } -
wf-cpanel-email-accounts/tags/5.3/includes/SiteHealth.php
r3086582 r3095910 52 52 53 53 \add_filter( 'debug_information', static function( array $debug_info ): array { 54 54 global $wpdb, $table_prefix; 55 55 $cpanel_path = UAPI::home_path(); 56 56 $emails_disk = UAPI::email_disk_usage(); … … 110 110 $x = _x( 'Apache SpamAssassin™', 'Site Health cPanel® Feature Name' ); 111 111 $x = _x( 'Apache SpamAssassin™ Spam Box', 'Site Health cPanel® Feature Name' ); 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 112 129 113 130 foreach ( [ … … 155 172 } 156 173 174 175 176 177 178 179 180 181 182 183 184 185 157 186 if ( ! \str_contains( $debug_info['wp-constants']['label'], __( 'WebFacing™' ) ) ) { 158 187 $debug_info['wp-constants']['label'] = \str_replace( ' ', ' & ' . __( 'WebFacing™' ) . ' ', $debug_info['wp-constants']['label'] ); … … 191 220 ]; 192 221 222 223 224 225 226 227 228 229 230 193 231 $debug_info['wp-constants']['fields']['WP_PLUGIN_URL' ] = [ 194 232 'label' => 'WP_PLUGIN_URL', … … 198 236 'debug' => \defined( 'WP_PLUGIN_URL' ) ? \WP_PLUGIN_URL : 'undefined', 199 237 ]; 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 200 320 201 321 $default = \is_ssl(); … … 295 415 ]; 296 416 297 if ( ! ( \defined( 'DISALLOW_FILE_MODS' ) && \DISALLOW_FILE_MODS ) ) { 417 // if ( ! ( \defined( 'DISALLOW_FILE_MODS' ) && \DISALLOW_FILE_MODS ) ) { 418 if ( \wp_is_file_mod_allowed( self::$screen->id ) ) { 298 419 299 420 $debug_info['wp-constants']['fields']['AUTOMATIC_UPDATER_DISABLED' ] = [ … … 347 468 348 469 if ( \defined( 'WP_DISABLE_FATAL_ERROR_HANDLER' ) && \WP_DISABLE_FATAL_ERROR_HANDLER ) { 349 350 $debug_info['wp-constants']['fields']['WP_SANDBOX_SCRAPING' ] = [351 'label' => 'WP_SANDBOX_SCRAPING',352 'value' => \defined( 'WP_SANDBOX_SCRAPING' ) ?353 ( self::is_bool( \WP_SANDBOX_SCRAPING ) ?354 ( \WP_SANDBOX_SCRAPING ?355 _x( 'Enabled', 'Site Health Info' ) :356 _x( 'Disabled', 'Site Health Info' )357 ) :358 \WP_SANDBOX_SCRAPING . ' ▮'359 ) :360 _x( 'Undefined', 'Site Health Info' ) . ' (' . __( 'not disabled' ) . ')',361 'debug' => \defined( 'WP_SANDBOX_SCRAPING' ) ? \WP_SANDBOX_SCRAPING : 'undefined',362 'private' => false,363 ];470 // 471 $debug_info['wp-constants']['fields']['WP_SANDBOX_SCRAPING' ] = [ 472 'label' => 'WP_SANDBOX_SCRAPING', 473 'value' => \defined( 'WP_SANDBOX_SCRAPING' ) ? 474 ( self::is_bool( \WP_SANDBOX_SCRAPING ) ? 475 ( \WP_SANDBOX_SCRAPING ? 476 _x( 'Enabled', 'Site Health Info' ) : 477 _x( 'Disabled', 'Site Health Info' ) 478 ) : 479 \WP_SANDBOX_SCRAPING . ' ▮' 480 ) : 481 _x( 'Undefined', 'Site Health Info' ) . ' (' . __( 'not disabled' ) . ')', 482 'debug' => \defined( 'WP_SANDBOX_SCRAPING' ) ? \WP_SANDBOX_SCRAPING : 'undefined', 483 'private' => false, 484 ]; 364 485 } else { 365 486 … … 374 495 } 375 496 376 $debug_info['wp-constants']['fields']['DISALLOW_FILE_MODS'] = [ 377 'label' => 'DISALLOW_FILE_MODS', 378 'value' => \defined( 'DISALLOW_FILE_MODS' ) ? 379 ( self::is_bool( \DISALLOW_FILE_MODS ) ? 380 ( \DISALLOW_FILE_MODS ? 381 _x( 'Disallowed', 'Site Health Info' ) . ' ▮' : 382 _x( 'Allowed', 'Site Health Info' ) 383 ) : 384 \DISALLOW_FILE_MODS . ( \DISALLOW_FILE_MODS ? ' ▮' : '' ) 497 $default = \MINUTE_IN_SECONDS; 498 $debug_info['wp-constants']['fields']['AUTOSAVE_INTERVAL' ] = [ 499 'label' => 'AUTOSAVE_INTERVAL', 500 'value' => \defined( 'AUTOSAVE_INTERVAL' ) ? 501 ( \is_bool( \AUTOSAVE_INTERVAL ) && ! \AUTOSAVE_INTERVAL ? 502 _x( 'Disabled', 'Site Health Info' ) . ' (' . __( 'none' ) . ' )' : 503 ( \is_numeric( \AUTOSAVE_INTERVAL ) ? 504 ( \AUTOSAVE_INTERVAL . ' (s)' . 505 ( \AUTOSAVE_INTERVAL === $default ? 506 '' : 507 ' (' . __( 'default:' ) . ' ' . $default . ')' 508 ) 509 ) : 510 \AUTOSAVE_INTERVAL . ' ▮' 511 ) 385 512 ) : 386 _x( 'Undefined', 'Site Health Info' ) . ' (' . _x( 'allowed', 'Site Health Info' ) . ')', 387 'debug' => \defined( 'DISALLOW_FILE_MODS' ) ? \DISALLOW_FILE_MODS : 'undefined', 388 'private' => false, 389 ]; 390 391 $default = \trailingslashit( \get_option( 'siteurl' ) ) . 'wp-content'; 392 $debug_info['wp-constants']['fields']['WP_CONTENT_URL'] = [ 393 'label' => 'WP_CONTENT_URL', 394 'value' => \defined( 'WP_CONTENT_URL' ) ? 395 \WP_CONTENT_URL : 396 _x( 'Undefined', 'Site Health Info' ) . ' (' . $default . ')', 397 'debug' => \defined( 'WP_CONTENT_URL' ) ? \WP_CONTENT_URL : 'undefined', 398 ]; 513 _x( 'Undefined', 'Site Health Info' ) . ' (' . \MINUTE_IN_SECONDS . 's)', 514 'debug' => \defined( 'AUTOSAVE_INTERVAL' ) ? \AUTOSAVE_INTERVAL : 'undefined', 515 ]; 516 399 517 $debug_info['wp-constants']['fields']['WF_CPANEL_API_TOKEN'] = [ 400 518 'label' => 'WF_CPANEL_API_TOKEN', … … 420 538 ]; 421 539 422 if ( self::$is_debug || \defined( 'WF_CPANEL_HOST') ) {540 if ( self::$is_debug || ) ) { 423 541 424 542 $debug_info['wp-constants']['fields']['WF_CPANEL_HOST'] = [ … … 488 606 $user_updated = UAPI::user_updated(); 489 607 $two_factor = UAPI::two_factor(); 608 609 490 610 $max_emails = UAPI::maximum_emails(); 611 491 612 $held_mails = UAPI::all_queued_emails(); 492 613 $contacts = UAPI::get_user_info(); … … 498 619 499 620 foreach ( UAPI::subaccounts() as $name => $subaccount ) { 500 $subaccounts[] = '● ' . $name . ( \property_exists( $subaccount, 'services' ) ? ' {' . \implode( ' ,', (array) $subaccount->services ) . '} ' : '' );621 $subaccounts[] = '● ' . $name . ( \property_exists( $subaccount, 'services' ) ? ' {' . \implode( ',', (array) $subaccount->services ) . '} ' : '' ); 501 622 } 502 623 $subaccounts = \implode( ', ', $subaccounts ); … … 553 674 } 554 675 } 555 return \ implode( ', ', $vals);676 return \ ); 556 677 } )(), 557 'debug' => \print_r( self::$usage, true ), 678 'debug' => \print_r( self::$license, true ), 679 'private' => ! self::$is_debug, 558 680 ], 559 681 'plugin_license' => [ … … 596 718 return \implode( '; ', $vals ); 597 719 } )(), 598 'debug' => \print_r( self::$usage, true ), 720 'debug' => ( self::$class::$usage == ( (object) '' ) ) ? null : \print_r( self::$class::$usage, true ), 721 'private' => ! self::$is_debug, 599 722 ], 600 723 'cpanel_version' => [ 601 724 'label' => _x( 'cPanel® version', 'Site Health Info' ), 602 'value' => \substr_replace( \number_format( 1 11.47 - ( 49. * \floatval( self::$cpanel_version ?: 8 ) / 115.), 2, '.', '' ), ' (build ', -1, 0 ) . ')',725 'value' => \substr_replace( \number_format( 1 ), 2, '.', '' ), ' (build ', -1, 0 ) . ')', 603 726 'debug' => self::$cpanel_version, 604 727 'private' => false, … … 628 751 'private' => false, 629 752 ], 630 // 'proisp' => [631 // 'label' => _x( 'At PRO ISP?', 'Site Health Info' ),632 // 'value' => ( self::$is_proisp ? __( 'Yes' ) : __( 'No' ) ) . ', ' . self::$package,633 // 'debug' => self::$is_proisp,634 // 'private' => ! self::$is_debug,635 // ],636 753 'features' => [ 637 754 'label' => _x( 'Features', 'Site Health Info' ), 638 755 'value' => \implode( ', ', $features ), 639 'debug' => \ implode( ',', \array_keys( $features ) ),756 'debug' => \implode( ',', \array_keys( $features ) ), 640 757 'private' => false, 641 758 ], 642 759 'cpanel_host' => [ 643 'label' => _x( 'Host', 'Site Health Info' ),760 'label' => _x( 'Host', 'Site Health Info' ), 644 761 'value' => self::$host_name, 645 762 'debug' => self::$host_name, … … 647 764 ], 648 765 'cpanel_user' => [ 649 'label' => _x( 'User', 'Site Health Info' ),766 'label' => _x( 'User', 'Site Health Info' ), 650 767 'value' => self::$cpanel_user, 651 768 'debug' => self::$cpanel_user, … … 654 771 'user_created' => [ 655 772 'label' => \sprintf( 656 _x( ' — User %1$s created', 657 'Site Health Info, %1$s = user' 773 /* translators: %1$s = user */ 774 _x( ' — User `%1$s` created', 775 'Site Health Info', 658 776 ), 659 self::$cpanel_user 777 self::$cpanel_user 660 778 ), 661 779 'value' => $user_created ? \wp_date( \get_option( 'date_format' ), $user_created ) : '', … … 664 782 ], 665 783 'user_updated' => [ 666 'label' => \sprintf( 667 _x( ' — User %1$s updated', 668 'Site Health Info, %1$s = user' 784 'label' => \sprintf( 785 /* translators: %1$s = user */ 786 _x( ' — User `%1$s` updated', 787 'Site Health Info', 669 788 ), 670 self::$cpanel_user 789 self::$cpanel_user 671 790 ), 672 791 'value' => $user_updated ? \wp_date( \get_option( 'date_format' ), $user_updated ) : '', … … 675 794 ], 676 795 'subaccounts' => [ 677 'label' => _x( ' — Subaccounts {services}', 'Site Health Info' ) . ' (' . ( $subaccounts ? \count( \explode( ', ', $subaccounts ) ) : 0 ) . ')',796 'label' => _x( ' — Subaccounts {services}', 'Site Health Info' ) . ' (' . ( $subaccounts ? \count( \explode( ', ', $subaccounts ) ) : 0 ) . ')', 678 797 'value' => $subaccounts, 679 798 'private' => ! self::$is_debug, … … 685 804 'private' => ! self::$is_debug, 686 805 ], 806 807 808 809 810 811 687 812 'mail_server' => [ 688 'label' => _x( 'Mail Server & Storage Format', 'Site Health Info' ),813 'label' => _x( 'Mail Server & Storage Format', 'Site Health Info' ), 689 814 'value' => \ucfirst( UAPI::server_info( 'mail_server' ) ) . ' ' . UAPI::server_info( 'mailbox_storage_format' ), 690 815 'private' => false, 691 816 ], 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 692 845 'webmail_apps' => [ 693 'label' => _x( 'Webmail Applications', 'Site Health Info' ),694 'value' => \implode( ', ', UAPI::webmail_apps() ),846 'label' => _x( 'Webmail Applications', 'Site Health Info' ), 847 'value' => \implode( ',', UAPI::webmail_apps() ), 695 848 'private' => false, 696 849 ], 697 850 'email_accounts_num' => [ 698 851 'label' => _x( 'Number of email accounts', 'Site Health Info' ), 699 'value' => \number_format_i18n( UAPI::count_emails() , 0, '' ),700 'debug' => UAPI::count_emails() ,852 'value' => \number_format_i18n( UAPI::count_emails(), 0, '' ), 853 'debug' => UAPI::count_emails(), 701 854 'private' => false, 702 855 ], … … 704 857 'label' => _x( 'Storage space used for emails', 'Site Health Info' ), 705 858 'value' => \size_format( $emails_disk, 1 ), 706 'debug' => \str_replace( ',', '.', \size_format( $emails_disk, 2 ) ),859 'debug' => \str_replace( ',', '.', \size_format( $emails_disk, 2 ) ), 707 860 'private' => false, 708 861 ], … … 714 867 \number_format_i18n( $max_emails ), 715 868 ), 716 'debug' => $max_emails . '/h',869 'debug' => $max_emails, 717 870 'private' => false, 718 871 ], … … 732 885 'label' => _x( ' — Addon domains', 'Site Health Info' ) . ' (' . \count( $addon_domains ) . ')', 733 886 'value' => ( $addon_domains ? '● ' : '' ) . \implode( ', ● ', \array_map( 'idn_to_utf8', $addon_domains ) ), 734 'debug' => \count( $addon_domains ) ? \implode( ', ', $addon_domains ) : '(none)',887 'debug' => \count( $addon_domains ) ? \implode( ', ', $addon_domains ) : '(none)', 735 888 'private' => ! self::$is_debug, 736 889 ], … … 739 892 'label' => _x( ' — Parked domains', 'Site Health Info' ) . ' (' . \count( $parked_domains ) . ')', 740 893 'value' => ( $parked_domains ? '● ' : '' ) . \implode( ', ● ', \array_map( 'idn_to_utf8', $parked_domains ) ), 741 'debug' => \count( $parked_domains ) ? \implode( ', ', $parked_domains ) : '(none)',894 'debug' => \count( $parked_domains ) ? \implode( ', ', $parked_domains ) : '(none)', 742 895 'private' => ! self::$is_debug, 743 896 ], … … 746 899 'label' => _x( ' — Dead domains', 'Site Health Info' ) . ' (' . \count( $dead_domains ) . ')', 747 900 'value' => ( \count( $dead_domains ) ? '● ' : '' ) . \implode( ', ● ', \array_map( 'idn_to_utf8', $dead_domains ) ), 748 'debug' => \count( $dead_domains ) ? \implode( ', ', $dead_domains ) : '(none)',901 'debug' => \count( $dead_domains ) ? \implode( ', ', $dead_domains ) : '(none)', 749 902 'private' => ! self::$is_debug, 750 903 ], 751 904 'contacts' => [ 752 'label' => _x( 'Contact email addresses','Site Health Info' ),905 'label' 'Site Health Info' ), 753 906 'value' => 754 907 ( $contacts->contact_email_2 ? '1. ' : '' ) . … … 762 915 ]; 763 916 764 if ( \is_multisite() ) { 765 // unset ( $debug_info[ self::$plugin->TextDomain ]['fields']['plugin_auto_updated'] ); 917 if ( ! \is_super_admin() ) { 918 unset ( 919 $debug_info[ self::$plugin->TextDomain ]['fields']['addon_domains'], 920 $debug_info[ self::$plugin->TextDomain ]['fields']['parked_domains'], 921 $debug_info[ self::$plugin->TextDomain ]['fields']['dead_domains'], 922 ); 766 923 } 767 924 … … 772 929 } 773 930 774 if ( ! \defined( 'WF_CPANEL_HOST' ) && ! \defined( 'WF_CPANEL_USER' ) && ! self::$is_debug ) {775 unset ( $debug_info[ self::$plugin->TextDomain ]['fields']['cpanel_host'] );776 }931 if ( ! \defined( 'WF_CPANEL_HOST' ) && ! \defined( 'WF_CPANEL_USER' ) && ! self::$is_debug ) { 932 unset ( $debug_info[ self::$plugin->TextDomain ]['fields']['cpanel_host'] ); 933 } 777 934 778 935 if ( $show_main ) { … … 981 1138 ]; 982 1139 983 if ( ! self::email_mx_self( self::$ main_domain ) ) {1140 if ( ! self::email_mx_self( self::$_domain ) ) { 984 1141 985 1142 /* translators: 1: domain name */ 986 $result['label' ] = \sprintf( _x( 'There will be issues receiving email from this server to addresses on \'%1$s\'.', 'Site Health Status Test Label' ), 987 \idn_to_utf8( self::$main_domain ) 1143 $result['label' ] = \sprintf( _x( 'There will be issues receiving email from this server to addresses on \'%1$s\'.', 1144 'Site Health Status Test Label', 1145 ), 1146 \idn_to_utf8( self::$site_domain ), 988 1147 ); 989 1148 $result['status'] = 'critical'; … … 994 1153 /* translators: 1: domain name */ 995 1154 \PHP_EOL . \sprintf( _x( 'You are advised to set the MX record for %1$s to point to this host or move the domain to this server.', 'Site Health Status Test Description' ), 996 '<code>' . self::$main_domain. '</code>'1155 '<code>' . . '</code>' 997 1156 ) ); 998 1157 999 $result['actions'] .= \sprintf( _x( 'To receive emails: Set the MX records to hostnames specified by your hosting provider.', 'Site Health Status Test Action' ), self::$main_domain ); 1158 $result['actions'] .= \sprintf( _x( 'To receive emails: Set the MX records to hostnames specified by your hosting provider.', 1159 'Site Health Status Test Action', 1160 ), 1161 \idn_to_utf8( self::$site_domain ), 1162 ); 1000 1163 } 1001 1164 return $result; -
wf-cpanel-email-accounts/tags/5.3/includes/UAPI.php
r3086582 r3095910 320 320 } 321 321 322 323 324 325 326 327 328 329 330 331 332 333 334 322 335 public static function maximum_emails(): int { 323 336 return (int) self::result( 'Variables', 'get_user_information' )->maximum_emails_per_hour; … … 333 346 foreach ( (array) self::result( 'Email', 'list_pops' ) as $account ) { 334 347 $held += (int) self::queued_emails( $account->email ); 348 349 350 335 351 } 336 352 return $held; -
wf-cpanel-email-accounts/tags/5.3/index.php
r3086738 r3095910 7 7 * Description: 🕸️ By WebFacing™. Lets you manage all email accounts, forwarders, autoresponders and also backup your hosting account. Let users manage their own email account, from admin or frontend, just by clicking a button. 8 8 * Plugin URI: https://webfacing.eu/ 9 * Version: 5.3. 19 * Version: 5.3. 10 10 * Author: Knut Sparhell 11 11 * Author URI: https://profiles.wordpress.org/knutsp/ … … 14 14 * Requires PHP: 8.1 15 15 * Requires at least: 6.5 16 * Tested up to: 6.5. 316 * Tested up to: 6.5. 17 17 * Tested up to PHP: 8.3 18 18 * Text Domain: wf-cpanel-email-accounts -
wf-cpanel-email-accounts/tags/5.3/readme.txt
r3095243 r3095910 4 4 Tags: cpanel, email, auto-reply, backup, membership 5 5 Requires at least: 6.5 6 Tested up to: 6.5. 36 Tested up to: 6.5. 7 7 Requires PHP: 8.1 8 8 Tested up to PHP: 8.3 … … 28 28 === Current features === 29 29 30 * **NEW :**Dashboard widget with three live graphic server memory usage and server load gauge charts (can eassily be minimized or hidden via Screen Options or programatically)30 * **NEW Dashboard widget with three live graphic server memory usage and server load gauge charts (can eassily be minimized or hidden via Screen Options or programatically) 31 31 * WP Block for frontend access user's own Webmail 32 32 * Bulk entry of forwarders and email accounts (as free trial only, very limited use) … … 38 38 * Semi automated migration to new email server, including setup of new accounts for users, with sending setup instructions, passwords and links to setup guides for most common email clients 39 39 * Add 10 single Email Accounts per week (without Pro nag) -- actually unlimited 40 * Delete single or multiple Email Accounts or other addresses40 * s 41 41 * List mailboxes with number of messages for each box 42 42 * Remove old messages from mailboxes (older than 52 weeks as default) … … 61 61 - The `WF_CPANEL_API_TOKEN` constant may be removed when a new token is created and activated from the plugin admin page 62 62 63 * Option to set the default visibility for users on the AddNew Email screen (users may still set their own preferences):63 * Option to set the default visibility for users on New Email screen (users may still set their own preferences): 64 64 - <code>add_filter( 'wf-cpanel-email-new-email_user-option', static function( bool $default, string $option, int $user_id ) { 65 66 67 68 65 if ( $option === 'wc-show-new-blackhole' /*or by $user_id*/ ) { 66 $default = true/*false*/; 67 } 68 return $default; 69 69 }, 10, 3 );</code> 70 70 … … 82 82 - <code>add_filter( 'wf_cpanel_email_widget_interval', static fn( int $interval ) => 45 );</code> 83 83 84 * Option to limit email addresses to current site domain, even for single site admins, *one* of the following :84 * Option to limit email addresses to current site domain, even for single site admins, *one* of the following 85 85 - <code>const WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY = true;</code> 86 86 - <code>define( 'WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY', true );</code> … … 103 103 - <code>const WF_CPANEL_HOST = 'my-host';</code> 104 104 - <code>define( 'WF_CPANEL_HOST', 'my-host' );</code> 105 - Using `WF_CPANEL_HOST`requires `WF_CPANEL_USER`, and also the `WF_CPANEL_API_TOKEN` to be declared or defined temporarily.106 107 * Automaticallly create new emailaccounts when a new user is registered?108 -<code>add_action( 'user_register', static function( int $user_id, array $userdata ): void {109 110 111 112 113 }, 2 );</code>105 - 106 107 * Automaticallly create new accounts when a new user is registered? 108 <code>add_action( 'user_register', static function( int $user_id, array $userdata ): void { 109 // What to do just after the registraton here, like this (adds an email address that forwards to all users, a mailing list): 110 if ( method_exists( 'WebFacing\cPanel\UAPI', 'add_forwarder' ) ) { 111 \WebFacing\cPanel\UAPI::add_forwarder( 'all-users@yoursite.tld, '$userdata['user_email'] ); 112 } 113 }, 2 );</code> 114 114 115 115 * Site Health … … 132 132 * Maximum New Forwarders = 20, Maximum New Accounts = 5, weekly reset 133 133 * Trial: Maximum New Forwarders as **bulk entry** = 4, Maximum New Accounts as **bulk entry** = 2 134 135 134 136 * Any admin (if multisite, only network admins), or user with the filtered capability, on a site, can fully access <em>any</em> account on the cPanel® server instance 135 137 * No AYS warnings for delete actions … … 172 174 173 175 Yes. You need three constants (you must declare or define them in ´wp-config.php´ or in another plugin) <code>WF_CPANEL_HOST</code>, 174 <code>WF_CPANEL_USER</code> and (temporarily) `WF_CPANEL_API_TOKEN`.176 <code>WF_CPANEL_USER</code> and (temporarily) 175 177 176 178 = Does it work without being on cPanel®? = … … 205 207 == Changelog == 206 208 209 210 211 212 213 214 215 216 217 207 218 = 5.3 = 208 219 209 220 - May 14, 2024 210 - Add resource usage dashboard widget with 3 grap hical gauge charts221 - Add resource usage dashboard widget with 3 grapical gauge charts 211 222 212 223 = 5.2.9 = 213 224 214 225 - May 12, 2024 215 - Fix fatal error: Uncaught TypeError in `UAPI-php`.226 - Fix fatal error: Uncaught TypeError in . 216 227 217 228 = 5.2.7 = … … 222 233 223 234 - Nov 14, 2023 224 - Fix fatal error: Uncaught TypeError in `UAPI-php`.225 - Fix warning: Attempt to read property "type" on null in `UAPI.php`.235 - Fix fatal error: Uncaught TypeError in . 236 - Fix warning: Attempt to read property "type" on null in . 226 237 227 238 = 5.2.5 =
Note: See TracChangeset
for help on using the changeset viewer.