wpCentral - Version 1.0

Version Description

Download this release

Release Info

Developer softacpriya
Plugin Icon 128x128 wpCentral
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (9) hide show
  1. actions.php +275 -0
  2. file_actions.php +59 -0
  3. get_site_data.php +46 -0
  4. readme.txt +39 -0
  5. verify.php +41 -0
  6. wpc_functions.php +2319 -0
  7. wpc_soft_pclzip.php +1531 -0
  8. wpcentral.php +63 -0
  9. wpcentral_lang.php +31 -0
actions.php ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')){
4
+ exit;
5
+ }
6
+
7
+ function wpc_site_actions(){
8
+ global $l, $error, $wp_config;
9
+
10
+ $return = array();
11
+
12
+ $request = wpc_optREQ('request');
13
+
14
+ if(empty($request)){
15
+ $return['error'] = $l['no_req_post'];
16
+ echo json_encode($return);
17
+ die();
18
+ }
19
+
20
+ if($request == 'update_website'){
21
+ $source = urldecode(wpc_optREQ('source'));
22
+
23
+ include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
24
+ include_once(ABSPATH.'wp-admin/includes/update.php');
25
+ include_once(ABSPATH.'wp-admin/includes/misc.php');
26
+
27
+ global $wp_filesystem;
28
+
29
+ $upgrade_error = array();
30
+
31
+ $wp_upgrader_skin = new WP_Upgrader_Skin();
32
+ $wp_upgrader_skin->done_header = true;
33
+
34
+ $wp_upgrader = new WP_Upgrader($wp_upgrader_skin);
35
+
36
+ $res = $wp_upgrader->fs_connect(array(get_home_path(), WP_CONTENT_DIR));
37
+ if (!$res || is_wp_error($res)){
38
+ $upgrade_error[] = $res;
39
+ }
40
+
41
+ $download = $wp_upgrader->download_package($source);
42
+ if (is_wp_error($download)){
43
+ $upgrade_error[] = $download;
44
+ }
45
+
46
+ $working_dir = $wp_upgrader->unpack_package($download);
47
+ if (is_wp_error($working_dir)){
48
+ $upgrade_error[] = $working_dir;
49
+ }
50
+
51
+ $wp_dir = trailingslashit($wp_filesystem->abspath());
52
+
53
+ if (!$wp_filesystem->copy($working_dir.'/wordpress/wp-admin/includes/update-core.php', $wp_dir.'wp-admin/includes/update-core.php', true)){
54
+ $wp_filesystem->delete($working_dir, true);
55
+
56
+ $upgrade_error[] = $l['copy_fail'];
57
+ }
58
+
59
+ $wp_filesystem->chmod($wp_dir.'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
60
+ include_once(get_home_path().'wp-admin/includes/update-core.php');
61
+
62
+ if(!function_exists('update_core')){
63
+ $upgrade_error[] = $l['call_update_fail'];
64
+ }
65
+
66
+ $result = update_core($working_dir, $wp_dir);
67
+ if(is_wp_error($result)){
68
+ $upgrade_error[] = $result->get_error_code();
69
+ }
70
+
71
+ if(!empty($upgrade_error)){
72
+ $return['error'] = 'error: '.implode("\n", $upgrade_error);
73
+ }
74
+ }
75
+
76
+ if(wpc_optGET('plugins') || wpc_optGET('plugin')){
77
+ $plugins = urldecode($_REQUEST['plugins']);
78
+ $arr_plugins = explode(',', $plugins);
79
+
80
+ if($request == 'activate'){//Activate
81
+
82
+ $res = wpc_activate_plugin($arr_plugins);
83
+ if(!$res){
84
+ $return['error'] = $l['err_activating_pl'];
85
+ }
86
+ }elseif($request == 'deactivate'){//Deactivate
87
+
88
+ $res = wpc_deactivate_plugin($arr_plugins);
89
+ if(!$res){
90
+ $return['error'] = $l['err_deactivating_pl'];
91
+ }
92
+ }elseif($request == 'delete'){//Deactivate and then Delete
93
+
94
+ $act_res = wpc_deactivate_plugin($arr_plugins);
95
+ if(!$act_res){
96
+ $return['error'] = $l['err_deactivating_del_pl'];
97
+ }
98
+
99
+ $result = delete_plugins($arr_plugins);
100
+ if(is_wp_error($result)) {
101
+ $return['error'] = $result->get_error_message();
102
+ }elseif($result === false) {
103
+ $return['error'] = $l['err_deleting_pl'];
104
+ }
105
+ }elseif($request == 'install'){//Install Plugins
106
+
107
+ $sources = urldecode($_REQUEST['sources']);
108
+ $arr_sources = explode(',', $sources);
109
+
110
+ foreach($arr_plugins as $plk => $plval){
111
+
112
+ //Skip if the plugin is already installed
113
+ if(wpc_is_plugin_installed($plval)){
114
+ continue;
115
+ }
116
+
117
+ $filename = basename(parse_url($arr_sources[$plk], PHP_URL_PATH));
118
+
119
+ $download_dest = $wp_config['uploads_dir'].'/'.$filename;
120
+ $unzip_dest = $wp_config['plugins_root_dir'];
121
+
122
+ wpc_get_web_file($arr_sources[$plk], $download_dest);
123
+
124
+ if(wpc_sfile_exists($download_dest)){
125
+ $res = wpc_unzip($download_dest, $unzip_dest);
126
+ }
127
+
128
+ @wpc_sunlink($download_dest);
129
+
130
+ //Activate the installed plugin
131
+ $all_installed_plugins = wpc_get_plugins();
132
+ $slugs = array_keys($all_installed_plugins);
133
+
134
+ $plugin_slug = '';
135
+ //Fetch slug of the installed plugin
136
+ foreach($slugs as $val){
137
+ if(strpos($val, $plval) !== false){
138
+ $plugin_slug = $val;
139
+ break;
140
+ }
141
+ }
142
+
143
+ wpc_activate_plugin(array($plugin_slug));
144
+ }
145
+
146
+ if(!empty($error)){
147
+ $return['error'] = $error;
148
+ }
149
+ }elseif($request == 'update'){
150
+
151
+ $plugin_name = urldecode(wpc_optREQ('plugin'));
152
+ $download_link = urldecode(wpc_optREQ('source'));
153
+ $site_url = urldecode(wpc_optREQ('siteurl'));
154
+
155
+ $filename = basename(parse_url($download_link, PHP_URL_PATH));
156
+
157
+ $download_dest = $wp_config['uploads_dir'].'/'.$filename;
158
+ $unzip_dest = $wp_config['plugins_root_dir'];
159
+
160
+ wpc_get_web_file($download_link, $download_dest);
161
+
162
+ if(wpc_sfile_exists($download_dest)){
163
+ $res = wpc_unzip($download_dest, $unzip_dest);
164
+ }
165
+
166
+ @wpc_sunlink($download_dest);
167
+
168
+ // Lets visit the installation once to make the changes in the database
169
+ //$resp = wpc_curl_call($site_url, 0, 5);
170
+ $resp = wp_remote_get($site_url);
171
+
172
+ if(!empty($error)){
173
+ $return['error'] = $error;
174
+ }
175
+ }
176
+ }elseif(wpc_optGET('themes') || wpc_optGET('theme')){
177
+
178
+ $themes = urldecode(wpc_optGET('themes'));
179
+ $arr_themes = explode(',', $themes);
180
+
181
+ $active_theme = array_keys(wpc_get_active_theme());
182
+
183
+ //Do not activate/delete the theme if it is active
184
+ foreach($arr_themes as $tk => $tv){
185
+ if($active_theme[0] == $tv){
186
+ unset($arr_themes[$tk]);
187
+ }
188
+ }
189
+
190
+ if($request == 'activate' && count($arr_themes) == 1){//Activate
191
+
192
+ $res = wpc_activate_theme($arr_themes);
193
+ if(!empty($error)){
194
+ $return['error'] = $error;
195
+ }
196
+ if(!$res){
197
+ $return['error'] = $l['err_activating_theme'];
198
+ }
199
+
200
+ }elseif($request == 'delete'){//Delete
201
+
202
+ $res = wpc_delete_theme($arr_themes);
203
+ if(!empty($error)){
204
+ $return['error'] = $error;
205
+ }
206
+ if(!$res){
207
+ $return['error'] = $l['err_deleting_theme'];
208
+ }
209
+
210
+ }elseif($request == 'install'){//Install Themes
211
+
212
+ $sources = urldecode($_REQUEST['sources']);
213
+ $arr_sources = explode(',', $sources);
214
+
215
+ foreach($arr_themes as $thk => $thval){
216
+
217
+ //Skip if the theme is already installed
218
+ if(wpc_is_theme_installed($thval)){
219
+ continue;
220
+ }
221
+
222
+ $filename = basename(parse_url($arr_sources[$thk], PHP_URL_PATH));
223
+
224
+ $download_dest = $wp_config['uploads_dir'].'/'.$filename;
225
+ $unzip_dest = $wp_config['themes_root_dir'].'/';
226
+
227
+ wpc_get_web_file($arr_sources[$thk], $download_dest);
228
+
229
+ if(wpc_sfile_exists($download_dest)){
230
+ $res = wpc_unzip($download_dest, $unzip_dest);
231
+ }
232
+
233
+ @wpc_sunlink($download_dest);
234
+ }
235
+
236
+ if(!empty($error)){
237
+ $return['error'] = $error;
238
+ }
239
+ }elseif($request == 'update'){//Update Theme
240
+
241
+ $theme_name = urldecode(wpc_optREQ('theme'));
242
+ $download_link = urldecode(wpc_optREQ('source'));
243
+ $site_url = urldecode(wpc_optREQ('siteurl'));
244
+
245
+ $filename = basename(parse_url($download_link, PHP_URL_PATH));
246
+
247
+ $download_dest = $wp_config['uploads_dir'].'/'.$filename;
248
+ $unzip_dest = $wp_config['themes_root_dir'].'/';
249
+
250
+ wpc_get_web_file($download_link, $download_dest);
251
+
252
+ if(wpc_sfile_exists($download_dest)){
253
+ $res = wpc_unzip($download_dest, $unzip_dest);
254
+ }
255
+
256
+ @wpc_sunlink($download_dest);
257
+
258
+ // Lets visit the installation once to make the changes in the database
259
+ //$resp = wpc_curl_call($site_url, 0, 5);
260
+ $resp = wp_remote_get($site_url);
261
+
262
+ if(!empty($error)){
263
+ $return['error'] = $error;
264
+ }
265
+ }
266
+ }
267
+
268
+ if(empty($return['error'])){
269
+ $return['result'] = 'done';
270
+ }
271
+
272
+ //Using serialize here as all_plugins contains class object which are not json_decoded in Softaculous.
273
+ echo json_encode($return);
274
+
275
+ }
file_actions.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')){
4
+ exit;
5
+ }
6
+
7
+ function wpc_file_actions(){
8
+ global $error, $l;
9
+
10
+ $return = array();
11
+
12
+ $action = wpc_optREQ('request');
13
+
14
+ if(empty($action)){
15
+ $return['error'] = $l['no_req_post'];
16
+ echo json_encode($return);
17
+ die();
18
+ }
19
+
20
+ if($action == 'put'){
21
+ $filename = urldecode(wpc_optREQ('filename'));
22
+ $putdata = base64_decode(wpc_optREQ('putdata'));
23
+
24
+ $func_response = wpc_put($filename, $putdata);
25
+
26
+ if($func_response){
27
+ $return['done'] = 'done';
28
+ }else{
29
+ $return['error'] = $l['err_exec'];
30
+ }
31
+
32
+ echo json_encode($return);
33
+ die();
34
+ }
35
+
36
+ $args = urldecode(wpc_optREQ('args'));
37
+
38
+ if(function_exists('wpc_'.$action)){
39
+ if(!empty($args)){
40
+ $func_response = call_user_func('wpc_'.$action, $args);
41
+ }else{
42
+ $func_response = call_user_func('wpc_'.$action);
43
+ }
44
+ //$return['func_response'] = $func_response;
45
+
46
+ if($func_response){
47
+ $return['done'] = $l['done'];
48
+ }else{
49
+ $return['error'] = $l['err_exec'];
50
+ }
51
+
52
+ }else{
53
+ $return['error'] = $l['func_not_found'];
54
+ }
55
+
56
+ echo json_encode($return);
57
+
58
+ }
59
+ ?>
get_site_data.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')){
4
+ exit;
5
+ }
6
+
7
+ function wpc_get_site_data(){
8
+ global $l, $wp_config, $error;
9
+
10
+ $return = array();
11
+
12
+ $type = wpc_optGET('type');
13
+
14
+ $return['wordpress_current_version'] = wpc_version_wp();
15
+
16
+ if($type == 'plugins'){
17
+ $return['active_plugins'] = wpc_get_option('active_plugins');
18
+ $all_plugins = wpc_get_plugins();
19
+
20
+ foreach($all_plugins as $pk => $pv){
21
+ $installed_version = $pv['Version'];
22
+ }
23
+
24
+ $outdated_plugins = wpc_get_outdated_plugins();
25
+
26
+ $outdated_plugins_keys = array_keys($outdated_plugins);
27
+ foreach($all_plugins as $allk => $allv){
28
+ if(in_array($allk, $outdated_plugins_keys)){
29
+ $all_plugins[$allk]['new_version'] = $outdated_plugins[$allk]->new_version;
30
+ }
31
+ }
32
+
33
+ $return['all_plugins'] = $all_plugins;
34
+
35
+ }elseif($type == 'themes'){
36
+
37
+ $return['active_theme'] = array_keys(wpc_get_active_theme());
38
+ $return['all_themes'] = wpc_get_installed_themes();
39
+
40
+ }else{
41
+ $return['error'] = $l['invalid_params'];
42
+ }
43
+
44
+ echo json_encode($return);
45
+
46
+ }
readme.txt ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === wpcentral ===
2
+ Contributors: softaculous
3
+ Tags: wpcentral, softaculous, sites, manage sites, backup, plugins, themes, manage wordpress,
4
+ Requires at least: 4.4
5
+ Tested up to: 4.9.8
6
+ Requires PHP: 5.3
7
+ Stable tag: 1.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ WPCentral provides a single-login centralized panel where you can manage tons of your WordPress websites efficiently, unitedly as well as singularly.
12
+
13
+ == Description ==
14
+
15
+ If ever you wanted a single panel to manage tons of your Wordpress websites from and save the hassle to login all your website's dashboards separately, you have it here at last. [wpcentral](https://wpcentral.co/ "Manage Multiple WordPress Websites") provides a single panel where you can add infinite number of Wordpress websites for free.
16
+
17
+ Key Features:
18
+
19
+ * Entire data of all your websites can be synced in wpcentral panel so that you may skim through the same without logging in separately. Even if you want to go into detail for any website, you can simply click and you will be logged into the website using the Single Sign On feature.
20
+
21
+ * Should you want to activate/deactivate a plugin/theme on n number of websites, you can achieve this from wpcentral panel using wpcentral plugin. Also, you can install and update the plugins/themes on all the websites in one go.
22
+
23
+ * You can also create Sets of common Plugins and Themes which you want to install on multiple websites together.
24
+
25
+ * If you are worried about loosing your data anytime in the future, we, hereby, resolve all your stress by providing you with the backup feature of your websites. In an unfortunate event, when you loose your website or your website gets corrupted, you can even restore the backup taken previously.
26
+
27
+ * A new WordPress update is out and you are all stressed up to update your websites? No worries, wpcentral helps you achieve the same without the need to go into the dashboard of each website separately.
28
+
29
+ Many more to come! We have a number of other features in our To Do list which we will be adding in the upcoming versions, so stay tuned!
30
+
31
+ Should you have any suggestions to improve wpcentral, want to see some related features in wpcentral to help you in the websites management or if you have any queries, you can open a ticket with us at https://www.softaculous.com/support/open.php.
32
+
33
+ == Installation ==
34
+ 1. Upload the plugin folder to your /wp-content/plugins/ folder
35
+ 2. Activate the plugin through the "Plugins" menu in WordPress.
36
+ 3. You can find the Connection Key by clicking on "View Connection Key" link that appears on the Plugins page.
37
+ 4. Go to [panel.wpcentral.co](https://panel.wpcentral.co/ "Manage Multiple WordPress Websites") and create an account.
38
+ 5. Add your website there by following the steps using the connection key.
39
+ 6. It's Done! You can now start exploring.
verify.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')){
4
+ exit;
5
+ }
6
+
7
+ function wpc_verify(){
8
+ global $l, $wpdb, $wp_version, $wp_config, $error;
9
+
10
+ $return = array();
11
+
12
+ $site_settings = array();
13
+ $site_settings['ver'] = $wp_version;
14
+ $site_settings['softpath'] = rtrim(get_home_path(), '/');
15
+ $site_settings['siteurl'] = get_option('siteurl');
16
+ $site_settings['adminurl'] = admin_url();
17
+ $site_settings['softdb'] = $wp_config['softdb'];
18
+ $site_settings['softdbuser'] = $wp_config['softdbuser'];
19
+ $site_settings['softdbhost'] = $wp_config['softdbhost'];
20
+ $site_settings['softdbpass'] = $wp_config['softdbpass'];
21
+ $site_settings['dbprefix'] = $wp_config['dbprefix'];
22
+ $site_settings['site_name'] = get_option('blogname');
23
+
24
+ //Fetch all the table names
25
+ $sql = "SHOW TABLES FROM ".$wp_config['softdb'];
26
+ $results = $wpdb->get_results($sql);
27
+
28
+ $site_settings['softdbtables'] = array();
29
+ foreach($results as $index => $value) {
30
+ foreach($value as $tableName) {
31
+ $site_settings['softdbtables'][] = $tableName;
32
+ }
33
+ }
34
+
35
+ $site_settings['backup_directory'] = $wp_config['plugins_root_dir'].'/wp-central/'.wpc_srandstr(64);
36
+
37
+ $return['data'] = $site_settings;
38
+
39
+ echo json_encode($return);
40
+
41
+ }
wpc_functions.php ADDED
@@ -0,0 +1,2319 @@