forked from Really-Simple-Plugins/really-simple-ssl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem-status.php
More file actions
157 lines (132 loc) · 4.34 KB
/
Copy pathsystem-status.php
File metadata and controls
157 lines (132 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
# No need for the template engine
define( 'WP_USE_THEMES', false );
//we set wp admin to true, so the backend features get loaded.
if (!defined('RSSSL_DOING_SYSTEM_STATUS')) define( 'RSSSL_DOING_SYSTEM_STATUS' , true);
#find the base path
define( 'BASE_PATH', find_wordpress_base_path()."/" );
# Load WordPress Core
require_once( BASE_PATH . 'wp-load.php' );
require_once( BASE_PATH . 'wp-includes/class-phpass.php' );
require_once( BASE_PATH . 'wp-admin/includes/image.php' );
require_once( BASE_PATH . 'wp-admin/includes/plugin.php');
//by deleting these we make sure these functions run again
delete_transient('rsssl_testpage');
delete_transient('rsssl_domain_list');
if ( current_user_can( 'manage_options' ) ) {
ob_start();
if ( defined( 'RSSSL_SAFE_MODE' ) && RSSSL_SAFE_MODE ) {
echo "SAFE MODE\n";
}
echo "General\n";
echo "Domain: " . site_url() . "\n";
echo "Plugin version: " . rsssl_version . "\n";
if ( RSSSL()->rsssl_certificate->is_valid() ) {
echo "SSL certificate is valid\n";
} else {
if ( RSSSL()->rsssl_certificate->detection_failed() ) {
echo "Not able to detect certificate\n";
} else {
echo "Invalid SSL certificate\n";
}
}
echo ( RSSSL()->really_simple_ssl->ssl_enabled ) ? "SSL is enabled\n\n"
: "SSL is not yet enabled\n\n";
echo "Options\n";
if ( RSSSL()->really_simple_ssl->autoreplace_insecure_links ) {
echo "* Mixed content fixer\n";
}
if ( RSSSL()->really_simple_ssl->wp_redirect ) {
echo "* WordPress redirect\n";
}
if ( RSSSL()->really_simple_ssl->htaccess_redirect ) {
echo "* htaccess redirect\n";
}
if ( RSSSL()->really_simple_ssl->do_not_edit_htaccess ) {
echo "* Stop editing the .htaccess file\n";
}
if ( RSSSL()->really_simple_ssl->switch_mixed_content_fixer_hook ) {
echo "* Use alternative method to fix mixed content\n";
}
if ( RSSSL()->really_simple_ssl->dismiss_all_notices ) {
echo "* Dismiss all Really Simple SSL notices\n";
}
echo "\n";
echo "Server information\n";
echo "Server: " . RSSSL()->rsssl_server->get_server() . "\n";
echo "SSL Type: " . RSSSL()->really_simple_ssl->ssl_type . "\n";
if ( is_multisite() ) {
echo "MULTISITE\n";
echo ( ! RSSSL()->rsssl_multisite->ssl_enabled_networkwide )
? "SSL is being activated per site\n"
: "SSL is activated network wide\n";
}
do_action( "rsssl_system_status" );
echo RSSSL()->really_simple_ssl->debug_log;
echo "\n\nConstants\n";
if ( defined( 'RSSSL_FORCE_ACTIVATE' ) ) {
echo "RSSSL_FORCE_ACTIVATE defined\n";
}
if ( defined( 'RSSSL_NO_FLUSH' ) ) {
echo "RSSSL_NO_FLUSH defined";
}
if ( defined( 'RSSSL_DISMISS_ACTIVATE_SSL_NOTICE' ) ) {
echo "RSSSL_DISMISS_ACTIVATE_SSL_NOTICE defined\n";
}
if ( defined( 'RLRSSSL_DO_NOT_EDIT_HTACCESS' ) ) {
echo "RLRSSSL_DO_NOT_EDIT_HTACCESS defined\n";
}
if ( defined( 'RSSSL_SAFE_MODE' ) ) {
echo "RSSSL_SAFE_MODE defined\n";
}
if ( defined( "RSSSL_SERVER_OVERRIDE" ) ) {
echo "RSSSL_SERVER_OVERRIDE defined\n";
}
if ( ! defined( 'RSSSL_FORCE_ACTIVATE' )
&& ! defined( 'RSSSL_NO_FLUSH' )
&& ! defined( 'RSSSL_DISMISS_ACTIVATE_SSL_NOTICE' )
&& ! defined( 'RLRSSSL_DO_NOT_EDIT_HTACCESS' )
&& ! defined( 'RSSSL_SAFE_MODE' )
&& ! defined( "RSSSL_SERVER_OVERRIDE" )
) {
echo "No constants defined\n";
}
$content = ob_get_clean();
if ( function_exists( 'mb_strlen' ) ) {
$fsize = mb_strlen( $content, '8bit' );
} else {
$fsize = strlen( $content );
}
$file_name = 'really-simple-ssl-system-status.txt';
header( "Content-type: application/octet-stream" );
//direct downloaden
header( "Content-Disposition: attachment; filename=\"" . $file_name
. "\"" );
//open in browser
//header("Content-Disposition: inline; filename=\"".$file_name."\"");
header( "Content-length: $fsize" );
header( "Cache-Control: private",
false ); // required for certain browsers
header( "Pragma: public" ); // required
header( "Expires: 0" );
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
header( "Content-Transfer-Encoding: binary" );
echo $content;
} else {
//should not be here, so redirect to home
wp_redirect( home_url() );
exit;
}
function find_wordpress_base_path() {
$dir = dirname(__FILE__);
do {
if( file_exists($dir."/wp-config.php") ) {
if (file_exists($dir."/current")){
return $dir.'/current';
} else {
return $dir;
}
}
} while( $dir = realpath("$dir/..") );
return null;
}