Version Description
- Better error reporting
- Improved connection reliability
Download this release
Release Info
Developer | infinitewp |
Plugin | InfiniteWP Client |
Version | 1.1.9 |
Comparing to | |
See all releases |
Code changes from version 1.1.8 to 1.1.9
- addons/backup_repository/backup_repository.class.php +6 -0
- addons/post_links/post.class.php +2 -2
- addons/wp_optimize/optimize.class.php +106 -0
- backup.class.php +57 -31
- core.class.php +761 -745
- init.php +89 -9
- lib/dropbox.php +3 -1
- pclzip.class.php +3 -0
- readme.txt +4 -0
- stats.class.php +2 -2
addons/backup_repository/backup_repository.class.php
CHANGED
@@ -59,17 +59,23 @@ class IWP_MMB_Backup_Repository extends IWP_MMB_Backup
|
|
59 |
//FTP, Amazon S3 or Dropbox
|
60 |
if (isset($account_info['iwp_ftp']) && !empty($account_info)) {
|
61 |
$account_info['iwp_ftp']['backup_file'] = $backup_file;
|
|
|
62 |
$return = $this->ftp_backup($account_info['iwp_ftp']);
|
|
|
63 |
}
|
64 |
|
65 |
if (isset($account_info['iwp_amazon_s3']) && !empty($account_info['iwp_amazon_s3'])) {
|
66 |
$account_info['iwp_amazon_s3']['backup_file'] = $backup_file;
|
|
|
67 |
$return = $this->amazons3_backup($account_info['iwp_amazon_s3']);
|
|
|
68 |
}
|
69 |
|
70 |
if (isset($account_info['iwp_dropbox']) && !empty($account_info['iwp_dropbox'])) {
|
71 |
$account_info['iwp_dropbox']['backup_file'] = $backup_file;
|
|
|
72 |
$return = $this->dropbox_backup($account_info['iwp_dropbox']);
|
|
|
73 |
}
|
74 |
|
75 |
if ($return == true && $del_host_file) {
|
59 |
//FTP, Amazon S3 or Dropbox
|
60 |
if (isset($account_info['iwp_ftp']) && !empty($account_info)) {
|
61 |
$account_info['iwp_ftp']['backup_file'] = $backup_file;
|
62 |
+
iwp_mmb_print_flush('FTP upload: Start');
|
63 |
$return = $this->ftp_backup($account_info['iwp_ftp']);
|
64 |
+
iwp_mmb_print_flush('FTP upload: End');
|
65 |
}
|
66 |
|
67 |
if (isset($account_info['iwp_amazon_s3']) && !empty($account_info['iwp_amazon_s3'])) {
|
68 |
$account_info['iwp_amazon_s3']['backup_file'] = $backup_file;
|
69 |
+
iwp_mmb_print_flush('Amazon S3 upload: Start');
|
70 |
$return = $this->amazons3_backup($account_info['iwp_amazon_s3']);
|
71 |
+
iwp_mmb_print_flush('Amazon S3 upload: End');
|
72 |
}
|
73 |
|
74 |
if (isset($account_info['iwp_dropbox']) && !empty($account_info['iwp_dropbox'])) {
|
75 |
$account_info['iwp_dropbox']['backup_file'] = $backup_file;
|
76 |
+
iwp_mmb_print_flush('Dropbox upload: Start');
|
77 |
$return = $this->dropbox_backup($account_info['iwp_dropbox']);
|
78 |
+
iwp_mmb_print_flush('Dropbox upload: End');
|
79 |
}
|
80 |
|
81 |
if ($return == true && $del_host_file) {
|
addons/post_links/post.class.php
CHANGED
@@ -92,7 +92,7 @@ class IWP_MMB_Post extends IWP_MMB_Core
|
|
92 |
|
93 |
//to find all the images
|
94 |
$match_count = preg_match_all('/(<a[^>]+href=\"([^"]+)\"[^>]*>)?(<\s*img.[^\/>]*src="([^"]+' . $iwp_mmb_regexp_url . '[^\s]+\.(jpg|jpeg|png|gif|bmp))"[^>]*>)/ixu', $post_data['post_content'], $get_urls, PREG_SET_ORDER);
|
95 |
-
|
96 |
///////////
|
97 |
//$html = $params['postContent'];
|
98 |
//
|
@@ -105,7 +105,7 @@ class IWP_MMB_Post extends IWP_MMB_Core
|
|
105 |
// $img[]['src'] = str_replace('\"','',$tag->getAttribute('src'));
|
106 |
// }
|
107 |
/////////////////
|
108 |
-
|
109 |
if ($match_count > 0) {
|
110 |
$attachments = array();
|
111 |
$post_content = $post_data['post_content'];
|
92 |
|
93 |
//to find all the images
|
94 |
$match_count = preg_match_all('/(<a[^>]+href=\"([^"]+)\"[^>]*>)?(<\s*img.[^\/>]*src="([^"]+' . $iwp_mmb_regexp_url . '[^\s]+\.(jpg|jpeg|png|gif|bmp))"[^>]*>)/ixu', $post_data['post_content'], $get_urls, PREG_SET_ORDER);
|
95 |
+
|
96 |
///////////
|
97 |
//$html = $params['postContent'];
|
98 |
//
|
105 |
// $img[]['src'] = str_replace('\"','',$tag->getAttribute('src'));
|
106 |
// }
|
107 |
/////////////////
|
108 |
+
|
109 |
if ($match_count > 0) {
|
110 |
$attachments = array();
|
111 |
$post_content = $post_data['post_content'];
|
addons/wp_optimize/optimize.class.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(basename($_SERVER['SCRIPT_FILENAME']) == "optimize.class.php"):
|
3 |
+
exit;
|
4 |
+
endif;
|
5 |
+
class IWP_MMB_Optimize extends IWP_MMB_Core
|
6 |
+
{
|
7 |
+
function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
}
|
11 |
+
|
12 |
+
function cleanup_system($cleanupType){
|
13 |
+
|
14 |
+
if (isset($cleanupType["clean-revisions"])) {
|
15 |
+
$text .= self::cleanup_type_process('revisions');
|
16 |
+
}
|
17 |
+
|
18 |
+
if (isset($cleanupType["clean-autodraft"])) {
|
19 |
+
$text .= self::cleanup_type_process('autodraft');
|
20 |
+
}
|
21 |
+
|
22 |
+
if (isset($cleanupType["clean-comments"])) {
|
23 |
+
$text .= self::cleanup_type_process('spam');
|
24 |
+
}
|
25 |
+
|
26 |
+
if (isset($cleanupType["unapproved-comments"])) {
|
27 |
+
$text .= self::cleanup_type_process('unapproved');
|
28 |
+
}
|
29 |
+
|
30 |
+
if (isset($cleanupType["optimize-db"])) {
|
31 |
+
$text .= self::cleanup_type_process('optimize-db');
|
32 |
+
//$text .= DB_NAME.__(" Database Optimized!<br>", 'wp-optimize');
|
33 |
+
}
|
34 |
+
|
35 |
+
if ($text !==''){
|
36 |
+
return $text;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
function cleanup_type_process($cleanupType){
|
41 |
+
global $wpdb;
|
42 |
+
$clean = ""; $message = "";
|
43 |
+
$optimized = array();
|
44 |
+
|
45 |
+
switch ($cleanupType) {
|
46 |
+
|
47 |
+
case "revisions":
|
48 |
+
$clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
|
49 |
+
$revisions = $wpdb->query( $clean );
|
50 |
+
$message .= $revisions.__(' post revisions deleted<br>', 'wp-optimize');
|
51 |
+
|
52 |
+
break;
|
53 |
+
|
54 |
+
|
55 |
+
case "autodraft":
|
56 |
+
$clean = "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'";
|
57 |
+
$autodraft = $wpdb->query( $clean );
|
58 |
+
$message .= $autodraft.__(' auto drafts deleted<br>', 'wp-optimize');
|
59 |
+
|
60 |
+
break;
|
61 |
+
|
62 |
+
case "spam":
|
63 |
+
$clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam';";
|
64 |
+
$comments = $wpdb->query( $clean );
|
65 |
+
$message .= $comments.__(' spam comments deleted<br>', 'wp-optimize');
|
66 |
+
break;
|
67 |
+
|
68 |
+
case "unapproved":
|
69 |
+
$clean = "DELETE FROM $wpdb->comments WHERE comment_approved = '0';";
|
70 |
+
$comments = $wpdb->query( $clean );
|
71 |
+
$message .= $comments.__(' unapproved comments deleted<br>', 'wp-optimize');
|
72 |
+
break;
|
73 |
+
|
74 |
+
case "optimize-db":
|
75 |
+
self::optimize_tables(true);
|
76 |
+
$message .= "Database ".DB_NAME." Optimized!<br>";
|
77 |
+
break;
|
78 |
+
|
79 |
+
default:
|
80 |
+
$message .= __('NO Actions Taken<br>', 'wp-optimize');
|
81 |
+
break;
|
82 |
+
} // end of switch
|
83 |
+
|
84 |
+
|
85 |
+
return $message;
|
86 |
+
|
87 |
+
} // end of function
|
88 |
+
|
89 |
+
function optimize_tables($Optimize=false){
|
90 |
+
|
91 |
+
$db_clean = DB_NAME;
|
92 |
+
|
93 |
+
$local_query = 'SHOW TABLE STATUS FROM `'. DB_NAME.'`';
|
94 |
+
$result = mysql_query($local_query);
|
95 |
+
if (mysql_num_rows($result)){
|
96 |
+
while ($row = mysql_fetch_array($result))
|
97 |
+
{
|
98 |
+
$local_query = 'OPTIMIZE TABLE '.$row[0];
|
99 |
+
$resultat = mysql_query($local_query);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
106 |
+
?>
|
backup.class.php
CHANGED
@@ -379,21 +379,23 @@ function delete_task_now($task_name){
|
|
379 |
chdir(IWP_BACKUP_DIR);
|
380 |
$zip = $this->get_zip();
|
381 |
$command = "$zip -q -r $comp_level $backup_file 'iwp_db'";
|
|
|
382 |
ob_start();
|
383 |
$result = $this->iwp_mmb_exec($command);
|
384 |
ob_get_clean();
|
385 |
-
|
386 |
/*zip_backup_db */
|
387 |
if(!$result){
|
388 |
$zip_archive_db_result = false;
|
389 |
if (class_exists("ZipArchive")) {
|
390 |
$this->_log("DB zip, fallback to ZipArchive");
|
|
|
391 |
$zip_archive_db_result = $this->zip_archive_backup_db($task_name, $db_result, $backup_file);
|
392 |
-
|
393 |
}
|
394 |
|
395 |
if (!$zip_archive_db_result) {
|
396 |
-
|
397 |
// fallback to pclzip
|
398 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
399 |
//require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
@@ -412,6 +414,7 @@ function delete_task_now($task_name){
|
|
412 |
else{
|
413 |
$result = $archive->add(IWP_DB_DIR, PCLZIP_OPT_REMOVE_PATH, IWP_BACKUP_DIR);
|
414 |
}
|
|
|
415 |
@unlink($db_result);
|
416 |
@unlink(IWP_BACKUP_DIR.'/iwp_db/index.php');
|
417 |
@rmdir(IWP_DB_DIR);
|
@@ -472,7 +475,7 @@ function delete_task_now($task_name){
|
|
472 |
}
|
473 |
|
474 |
|
475 |
-
if (isset($backup_settings[$task_name]['task_args']['account_info']['iwp_ftp'])) {
|
476 |
$paths['ftp'] = basename($backup_url);
|
477 |
}
|
478 |
|
@@ -510,13 +513,14 @@ if (isset($backup_settings[$task_name]['task_args']['account_info']['iwp_ftp']))
|
|
510 |
/*
|
511 |
//IWP Remove starts here //IWP Remove ends here
|
512 |
*/
|
513 |
-
if ($task_name != 'Backup Now') {
|
514 |
|
515 |
-
if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
516 |
$this->update_status($task_name, $this->statuses['ftp']);
|
517 |
$account_info['iwp_ftp']['backup_file'] = $backup_file;
|
|
|
518 |
$ftp_result = $this->ftp_backup($account_info['iwp_ftp']);
|
519 |
-
|
520 |
if ($ftp_result !== true && $del_host_file) {
|
521 |
@unlink($backup_file);
|
522 |
}
|
@@ -531,7 +535,9 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
531 |
if (isset($account_info['iwp_amazon_s3']) && !empty($account_info['iwp_amazon_s3'])) {
|
532 |
$this->update_status($task_name, $this->statuses['s3']);
|
533 |
$account_info['iwp_amazon_s3']['backup_file'] = $backup_file;
|
|
|
534 |
$amazons3_result = $this->amazons3_backup($account_info['iwp_amazon_s3']);
|
|
|
535 |
if ($amazons3_result !== true && $del_host_file) {
|
536 |
@unlink($backup_file);
|
537 |
}
|
@@ -545,7 +551,9 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
545 |
if (isset($account_info['iwp_dropbox']) && !empty($account_info['iwp_dropbox'])) {
|
546 |
$this->update_status($task_name, $this->statuses['dropbox']);
|
547 |
$account_info['iwp_dropbox']['backup_file'] = $backup_file;
|
|
|
548 |
$dropbox_result = $this->dropbox_backup($account_info['iwp_dropbox']);
|
|
|
549 |
if ($dropbox_result !== true && $del_host_file) {
|
550 |
@unlink($backup_file);
|
551 |
}
|
@@ -596,27 +604,27 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
596 |
$disable_comp = $this->tasks[$task_name]['task_args']['disable_comp'];
|
597 |
$comp_level = $disable_comp ? '-0' : '-1';
|
598 |
$zip = $this->get_zip();
|
599 |
-
|
600 |
//Add database file
|
601 |
chdir(IWP_BACKUP_DIR);
|
602 |
$command = "$zip -q -r $comp_level $backup_file 'iwp_db'";
|
603 |
ob_start();
|
604 |
$result = $this->iwp_mmb_exec($command);
|
605 |
ob_get_clean();
|
606 |
-
|
607 |
/*zip_backup_db*/
|
608 |
|
609 |
if(!$result){
|
610 |
$zip_archive_db_result = false;
|
611 |
if (class_exists("ZipArchive")) {
|
612 |
-
|
613 |
$this->_log("DB zip, fallback to ZipArchive");
|
614 |
$zip_archive_db_result = $this->zip_archive_backup_db($task_name, $db_result, $backup_file);
|
615 |
-
|
616 |
}
|
617 |
|
618 |
if (!$zip_archive_db_result) {
|
619 |
-
|
620 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
621 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/pclzip.class.php';
|
622 |
$archive = new IWPPclZip($backup_file);
|
@@ -633,7 +641,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
633 |
else{
|
634 |
$result_db = $archive->add(IWP_DB_DIR, PCLZIP_OPT_REMOVE_PATH, IWP_BACKUP_DIR);
|
635 |
}
|
636 |
-
|
637 |
|
638 |
@unlink($db_result);
|
639 |
@unlink(IWP_BACKUP_DIR.'/iwp_db/index.php');
|
@@ -742,11 +750,12 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
742 |
$do_cmd_zip_alternative = false;
|
743 |
@copy($backup_file, $backup_file.'_2');
|
744 |
|
745 |
-
|
746 |
$command = "$zip -q -j $comp_level $backup_file .* * $exclude_file_data";
|
747 |
ob_start();
|
748 |
$result_f = $this->iwp_mmb_exec($command, false, true);
|
749 |
ob_get_clean();
|
|
|
750 |
if (!$result_f || $result_f == 18) { // disregard permissions error, file can't be accessed
|
751 |
$command = "$zip -q -r $comp_level $backup_file $include_data $exclude_data";
|
752 |
ob_start();
|
@@ -761,13 +770,13 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
761 |
//return array(
|
762 |
// 'error' => 'Failed to archive files (' . $zip_errors[$result_d] . ') .'
|
763 |
// );
|
764 |
-
|
765 |
}
|
766 |
else{
|
767 |
//return array(
|
768 |
// 'error' => 'Failed to archive files.'
|
769 |
//);
|
770 |
-
|
771 |
}
|
772 |
}
|
773 |
}
|
@@ -776,7 +785,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
776 |
@unlink($backup_file.'_2');
|
777 |
}
|
778 |
|
779 |
-
|
780 |
if (($result_f && $result_f != 18) || ($do_cmd_zip_alternative)) {
|
781 |
|
782 |
if($do_cmd_zip_alternative){
|
@@ -786,15 +795,15 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
786 |
|
787 |
$zip_archive_result = false;
|
788 |
if (class_exists("ZipArchive")) {
|
789 |
-
|
790 |
$this->_log("Files zip fallback to ZipArchive");
|
791 |
$zip_archive_result = $this->zip_archive_backup($task_name, $backup_file, $exclude, $include);
|
792 |
-
|
793 |
}
|
794 |
|
795 |
|
796 |
if (!$zip_archive_result) { //Try pclZip
|
797 |
-
|
798 |
if (!isset($archive)) {
|
799 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
800 |
//require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
@@ -854,7 +863,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
854 |
$result = $archive->add($include_data, PCLZIP_OPT_REMOVE_PATH, ABSPATH, PCLZIP_OPT_IWP_EXCLUDE, $exclude_data);
|
855 |
}
|
856 |
|
857 |
-
|
858 |
|
859 |
if (!$result) {
|
860 |
@unlink($backup_file);
|
@@ -922,6 +931,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
922 |
}
|
923 |
if ($result === true) {
|
924 |
foreach ($filelist as $file) {
|
|
|
925 |
$result = $result && $zip->addFile($file, sprintf("%s", str_replace(ABSPATH, '', $file))); // Tries to add a new file to $backup_file
|
926 |
}
|
927 |
$result = $result && $zip->close(); // Tries to close $backup_file
|
@@ -989,11 +999,11 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
989 |
$paths = $this->check_mysql_paths();
|
990 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
991 |
$command = $brace . $paths['mysqldump'] . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
|
992 |
-
|
993 |
ob_start();
|
994 |
$result = $this->iwp_mmb_exec($command);
|
995 |
ob_get_clean();
|
996 |
-
|
997 |
|
998 |
if (!$result) { // Fallback to php
|
999 |
$result = $this->backup_db_php($file);
|
@@ -1013,7 +1023,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1013 |
global $wpdb;
|
1014 |
|
1015 |
if(empty($GLOBALS['fail_safe_db'])){
|
1016 |
-
|
1017 |
$fp = fopen( $file, 'w' );
|
1018 |
if ( !mysql_ping( $wpdb->dbh ) ) {
|
1019 |
mysql_connect( DB_HOST, DB_USER, DB_PASSWORD );
|
@@ -1036,6 +1046,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1036 |
|
1037 |
//$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
1038 |
foreach ($tables as $table) {
|
|
|
1039 |
|
1040 |
$insert_sql .= "DROP TABLE IF EXISTS $table;";
|
1041 |
//create table
|
@@ -1094,13 +1105,14 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1094 |
}
|
1095 |
fclose( $fp );
|
1096 |
unset ($fp);
|
1097 |
-
|
1098 |
}
|
1099 |
else{
|
1100 |
-
|
1101 |
file_put_contents($file, '');//safe to reset any old data
|
1102 |
$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
1103 |
foreach ($tables as $table) {
|
|
|
1104 |
//drop existing table
|
1105 |
$dump_data = "DROP TABLE IF EXISTS $table[0];";
|
1106 |
file_put_contents($file, $dump_data, FILE_APPEND);
|
@@ -1116,6 +1128,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1116 |
$count = 1;
|
1117 |
|
1118 |
for ($i = 0; $i < $count; $i++) {
|
|
|
1119 |
$low_limit = $i * 100;
|
1120 |
$qry = "SELECT * FROM $table[0] LIMIT $low_limit, 100";
|
1121 |
$rows = $wpdb->get_results($qry, ARRAY_A);
|
@@ -1143,7 +1156,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1143 |
unset($rows);
|
1144 |
unset($dump_data);
|
1145 |
}
|
1146 |
-
|
1147 |
}
|
1148 |
|
1149 |
if (filesize($file) == 0 || !is_file($file)) {
|
@@ -1192,7 +1205,9 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1192 |
$ftp_file = $task['task_results'][$result_id]['ftp'];
|
1193 |
$args = $task['task_args']['account_info']['iwp_ftp'];
|
1194 |
$args['backup_file'] = $ftp_file;
|
|
|
1195 |
$backup_file = $this->get_ftp_backup($args);
|
|
|
1196 |
if ($backup_file == false) {
|
1197 |
return array(
|
1198 |
'error' => 'Failed to download file from FTP.'
|
@@ -1202,7 +1217,9 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1202 |
$amazons3_file = $task['task_results'][$result_id]['amazons3'];
|
1203 |
$args = $task['task_args']['account_info']['iwp_amazon_s3'];
|
1204 |
$args['backup_file'] = $amazons3_file;
|
|
|
1205 |
$backup_file = $this->get_amazons3_backup($args);
|
|
|
1206 |
if ($backup_file == false) {
|
1207 |
return array(
|
1208 |
'error' => 'Failed to download file from Amazon S3.'
|
@@ -1212,7 +1229,9 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1212 |
$dropbox_file = $task['task_results'][$result_id]['dropbox'];
|
1213 |
$args = $task['task_args']['account_info']['iwp_dropbox'];
|
1214 |
$args['backup_file'] = $dropbox_file;
|
|
|
1215 |
$backup_file = $this->get_dropbox_backup($args);
|
|
|
1216 |
|
1217 |
if ($backup_file == false) {
|
1218 |
return array(
|
@@ -1269,16 +1288,20 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1269 |
chdir(ABSPATH);
|
1270 |
$unzip = $this->get_unzip();
|
1271 |
$command = "$unzip -o $backup_file";
|
|
|
1272 |
ob_start();
|
1273 |
$result = $this->iwp_mmb_exec($command);
|
1274 |
ob_get_clean();
|
|
|
1275 |
|
1276 |
if (!$result) { //fallback to pclzip
|
1277 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
1278 |
//require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
1279 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/pclzip.class.php';
|
|
|
1280 |
$archive = new IWPPclZip($backup_file);
|
1281 |
$result = $archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
|
|
|
1282 |
}
|
1283 |
$this->wpdb_reconnect();
|
1284 |
|
@@ -1440,10 +1463,11 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1440 |
|
1441 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
1442 |
$command = $brace . $paths['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --default-character-set="utf8" ' . DB_NAME . ' < ' . $brace . $file_name . $brace;
|
1443 |
-
|
1444 |
ob_start();
|
1445 |
$result = $this->iwp_mmb_exec($command);
|
1446 |
ob_get_clean();
|
|
|
1447 |
if (!$result) {
|
1448 |
//try php
|
1449 |
$this->restore_db_php($file_name);
|
@@ -1466,6 +1490,7 @@ if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
|
1466 |
// Loop through each line
|
1467 |
if(!empty($lines)){
|
1468 |
foreach ($lines as $line) {
|
|
|
1469 |
// Skip it if it's a comment
|
1470 |
if (substr($line, 0, 2) == '--' || $line == '')
|
1471 |
continue;
|
@@ -1918,9 +1943,10 @@ function ftp_backup($args)
|
|
1918 |
$temp = ABSPATH . 'iwp_temp_backup.zip';
|
1919 |
|
1920 |
try {
|
1921 |
-
|
1922 |
-
$
|
1923 |
-
$
|
|
|
1924 |
fclose($handle);
|
1925 |
|
1926 |
if($result)
|
379 |
chdir(IWP_BACKUP_DIR);
|
380 |
$zip = $this->get_zip();
|
381 |
$command = "$zip -q -r $comp_level $backup_file 'iwp_db'";
|
382 |
+
iwp_mmb_print_flush('DB ZIP CMD: Start');
|
383 |
ob_start();
|
384 |
$result = $this->iwp_mmb_exec($command);
|
385 |
ob_get_clean();
|
386 |
+
iwp_mmb_print_flush('DB ZIP CMD: End');
|
387 |
/*zip_backup_db */
|
388 |
if(!$result){
|
389 |
$zip_archive_db_result = false;
|
390 |
if (class_exists("ZipArchive")) {
|
391 |
$this->_log("DB zip, fallback to ZipArchive");
|
392 |
+
iwp_mmb_print_flush('DB ZIP Archive: Start');
|
393 |
$zip_archive_db_result = $this->zip_archive_backup_db($task_name, $db_result, $backup_file);
|
394 |
+
iwp_mmb_print_flush('DB ZIP Archive: End');
|
395 |
}
|
396 |
|
397 |
if (!$zip_archive_db_result) {
|
398 |
+
iwp_mmb_print_flush('DB ZIP PCL: Start');
|
399 |
// fallback to pclzip
|
400 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
401 |
//require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
414 |
else{
|
415 |
$result = $archive->add(IWP_DB_DIR, PCLZIP_OPT_REMOVE_PATH, IWP_BACKUP_DIR);
|
416 |
}
|
417 |
+
iwp_mmb_print_flush('DB ZIP PCL: End');
|
418 |
@unlink($db_result);
|
419 |
@unlink(IWP_BACKUP_DIR.'/iwp_db/index.php');
|
420 |
@rmdir(IWP_DB_DIR);
|
475 |
}
|
476 |
|
477 |
|
478 |
+
if (isset($backup_settings[$task_name]['task_args']['account_info']['iwp_ftp'])) {
|
479 |
$paths['ftp'] = basename($backup_url);
|
480 |
}
|
481 |
|
513 |
/*
|
514 |
//IWP Remove starts here //IWP Remove ends here
|
515 |
*/
|
516 |
+
if ($task_name != 'Backup Now') {
|
517 |
|
518 |
+
if (isset($account_info['iwp_ftp']) && !empty($account_info['iwp_ftp'])) {
|
519 |
$this->update_status($task_name, $this->statuses['ftp']);
|
520 |
$account_info['iwp_ftp']['backup_file'] = $backup_file;
|
521 |
+
iwp_mmb_print_flush('FTP upload: Start');
|
522 |
$ftp_result = $this->ftp_backup($account_info['iwp_ftp']);
|
523 |
+
iwp_mmb_print_flush('FTP upload: End');
|
524 |
if ($ftp_result !== true && $del_host_file) {
|
525 |
@unlink($backup_file);
|
526 |
}
|
535 |
if (isset($account_info['iwp_amazon_s3']) && !empty($account_info['iwp_amazon_s3'])) {
|
536 |
$this->update_status($task_name, $this->statuses['s3']);
|
537 |
$account_info['iwp_amazon_s3']['backup_file'] = $backup_file;
|
538 |
+
iwp_mmb_print_flush('Amazon S3 upload: Start');
|
539 |
$amazons3_result = $this->amazons3_backup($account_info['iwp_amazon_s3']);
|
540 |
+
iwp_mmb_print_flush('Amazon S3 upload: End');
|
541 |
if ($amazons3_result !== true && $del_host_file) {
|
542 |
@unlink($backup_file);
|
543 |
}
|
551 |
if (isset($account_info['iwp_dropbox']) && !empty($account_info['iwp_dropbox'])) {
|
552 |
$this->update_status($task_name, $this->statuses['dropbox']);
|
553 |
$account_info['iwp_dropbox']['backup_file'] = $backup_file;
|
554 |
+
iwp_mmb_print_flush('Dropbox upload: Start');
|
555 |
$dropbox_result = $this->dropbox_backup($account_info['iwp_dropbox']);
|
556 |
+
iwp_mmb_print_flush('Dropbox upload: End');
|
557 |
if ($dropbox_result !== true && $del_host_file) {
|
558 |
@unlink($backup_file);
|
559 |
}
|
604 |
$disable_comp = $this->tasks[$task_name]['task_args']['disable_comp'];
|
605 |
$comp_level = $disable_comp ? '-0' : '-1';
|
606 |
$zip = $this->get_zip();
|
607 |
+
iwp_mmb_print_flush('DB ZIP CMD: Start');
|
608 |
//Add database file
|
609 |
chdir(IWP_BACKUP_DIR);
|
610 |
$command = "$zip -q -r $comp_level $backup_file 'iwp_db'";
|
611 |
ob_start();
|
612 |
$result = $this->iwp_mmb_exec($command);
|
613 |
ob_get_clean();
|
614 |
+
iwp_mmb_print_flush('DB ZIP CMD: End');
|
615 |
/*zip_backup_db*/
|
616 |
|
617 |
if(!$result){
|
618 |
$zip_archive_db_result = false;
|
619 |
if (class_exists("ZipArchive")) {
|
620 |
+
iwp_mmb_print_flush('DB ZIP Archive: Start');
|
621 |
$this->_log("DB zip, fallback to ZipArchive");
|
622 |
$zip_archive_db_result = $this->zip_archive_backup_db($task_name, $db_result, $backup_file);
|
623 |
+
iwp_mmb_print_flush('DB ZIP Archive: End');
|
624 |
}
|
625 |
|
626 |
if (!$zip_archive_db_result) {
|
627 |
+
iwp_mmb_print_flush('DB ZIP PCL: Start');
|
628 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
629 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/pclzip.class.php';
|
630 |
$archive = new IWPPclZip($backup_file);
|
641 |
else{
|
642 |
$result_db = $archive->add(IWP_DB_DIR, PCLZIP_OPT_REMOVE_PATH, IWP_BACKUP_DIR);
|
643 |
}
|
644 |
+
iwp_mmb_print_flush('DB ZIP PCL: End');
|
645 |
|
646 |
@unlink($db_result);
|
647 |
@unlink(IWP_BACKUP_DIR.'/iwp_db/index.php');
|
750 |
$do_cmd_zip_alternative = false;
|
751 |
@copy($backup_file, $backup_file.'_2');
|
752 |
|
753 |
+
iwp_mmb_print_flush('Files ZIP CMD: Start');
|
754 |
$command = "$zip -q -j $comp_level $backup_file .* * $exclude_file_data";
|
755 |
ob_start();
|
756 |
$result_f = $this->iwp_mmb_exec($command, false, true);
|
757 |
ob_get_clean();
|
758 |
+
iwp_mmb_print_flush('Files ZIP CMD: 1/2 over');
|
759 |
if (!$result_f || $result_f == 18) { // disregard permissions error, file can't be accessed
|
760 |
$command = "$zip -q -r $comp_level $backup_file $include_data $exclude_data";
|
761 |
ob_start();
|
770 |
//return array(
|
771 |
// 'error' => 'Failed to archive files (' . $zip_errors[$result_d] . ') .'
|
772 |
// );
|
773 |
+
iwp_mmb_print_flush('Files ZIP CMD: Failed to archive files (' . $zip_errors[$result_d] . ') .');
|
774 |
}
|
775 |
else{
|
776 |
//return array(
|
777 |
// 'error' => 'Failed to archive files.'
|
778 |
//);
|
779 |
+
iwp_mmb_print_flush('Files ZIP CMD: Failed to archive files.');
|
780 |
}
|
781 |
}
|
782 |
}
|
785 |
@unlink($backup_file.'_2');
|
786 |
}
|
787 |
|
788 |
+
iwp_mmb_print_flush('Files ZIP CMD: End');
|
789 |
if (($result_f && $result_f != 18) || ($do_cmd_zip_alternative)) {
|
790 |
|
791 |
if($do_cmd_zip_alternative){
|
795 |
|
796 |
$zip_archive_result = false;
|
797 |
if (class_exists("ZipArchive")) {
|
798 |
+
iwp_mmb_print_flush('Files ZIP Archive: Start');
|
799 |
$this->_log("Files zip fallback to ZipArchive");
|
800 |
$zip_archive_result = $this->zip_archive_backup($task_name, $backup_file, $exclude, $include);
|
801 |
+
iwp_mmb_print_flush('Files ZIP Archive: End');
|
802 |
}
|
803 |
|
804 |
|
805 |
if (!$zip_archive_result) { //Try pclZip
|
806 |
+
iwp_mmb_print_flush('Files ZIP PCL: Start');
|
807 |
if (!isset($archive)) {
|
808 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
809 |
//require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
863 |
$result = $archive->add($include_data, PCLZIP_OPT_REMOVE_PATH, ABSPATH, PCLZIP_OPT_IWP_EXCLUDE, $exclude_data);
|
864 |
}
|
865 |
|
866 |
+
iwp_mmb_print_flush('Files ZIP PCL: End');
|
867 |
|
868 |
if (!$result) {
|
869 |
@unlink($backup_file);
|
931 |
}
|
932 |
if ($result === true) {
|
933 |
foreach ($filelist as $file) {
|
934 |
+
iwp_mmb_auto_print('zip_archive_backup');
|
935 |
$result = $result && $zip->addFile($file, sprintf("%s", str_replace(ABSPATH, '', $file))); // Tries to add a new file to $backup_file
|
936 |
}
|
937 |
$result = $result && $zip->close(); // Tries to close $backup_file
|
999 |
$paths = $this->check_mysql_paths();
|
1000 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
1001 |
$command = $brace . $paths['mysqldump'] . $brace . ' --force --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
|
1002 |
+
iwp_mmb_print_flush('DB DUMP CMD: Start');
|
1003 |
ob_start();
|
1004 |
$result = $this->iwp_mmb_exec($command);
|
1005 |
ob_get_clean();
|
1006 |
+
iwp_mmb_print_flush('DB DUMP CMD: End');
|
1007 |
|
1008 |
if (!$result) { // Fallback to php
|
1009 |
$result = $this->backup_db_php($file);
|
1023 |
global $wpdb;
|
1024 |
|
1025 |
if(empty($GLOBALS['fail_safe_db'])){
|
1026 |
+
iwp_mmb_print_flush('DB DUMP PHP Normal: Start');
|
1027 |
$fp = fopen( $file, 'w' );
|
1028 |
if ( !mysql_ping( $wpdb->dbh ) ) {
|
1029 |
mysql_connect( DB_HOST, DB_USER, DB_PASSWORD );
|
1046 |
|
1047 |
//$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
1048 |
foreach ($tables as $table) {
|
1049 |
+
iwp_mmb_auto_print('backup_db_php_normal');
|
1050 |
|
1051 |
$insert_sql .= "DROP TABLE IF EXISTS $table;";
|
1052 |
//create table
|
1105 |
}
|
1106 |
fclose( $fp );
|
1107 |
unset ($fp);
|
1108 |
+
iwp_mmb_print_flush('DB DUMP PHP Normal: End');
|
1109 |
}
|
1110 |
else{
|
1111 |
+
iwp_mmb_print_flush('DB DUMP PHP Fail-safe: Start');
|
1112 |
file_put_contents($file, '');//safe to reset any old data
|
1113 |
$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
1114 |
foreach ($tables as $table) {
|
1115 |
+
|
1116 |
//drop existing table
|
1117 |
$dump_data = "DROP TABLE IF EXISTS $table[0];";
|
1118 |
file_put_contents($file, $dump_data, FILE_APPEND);
|
1128 |
$count = 1;
|
1129 |
|
1130 |
for ($i = 0; $i < $count; $i++) {
|
1131 |
+
iwp_mmb_auto_print('backup_db_php_fail_safe');
|
1132 |
$low_limit = $i * 100;
|
1133 |
$qry = "SELECT * FROM $table[0] LIMIT $low_limit, 100";
|
1134 |
$rows = $wpdb->get_results($qry, ARRAY_A);
|
1156 |
unset($rows);
|
1157 |
unset($dump_data);
|
1158 |
}
|
1159 |
+
iwp_mmb_print_flush('DB DUMP PHP Fail-safe: End');
|
1160 |
}
|
1161 |
|
1162 |
if (filesize($file) == 0 || !is_file($file)) {
|
1205 |
$ftp_file = $task['task_results'][$result_id]['ftp'];
|
1206 |
$args = $task['task_args']['account_info']['iwp_ftp'];
|
1207 |
$args['backup_file'] = $ftp_file;
|
1208 |
+
iwp_mmb_print_flush('FTP download: Start');
|
1209 |
$backup_file = $this->get_ftp_backup($args);
|
1210 |
+
iwp_mmb_print_flush('FTP download: End');
|
1211 |
if ($backup_file == false) {
|
1212 |
return array(
|
1213 |
'error' => 'Failed to download file from FTP.'
|
1217 |
$amazons3_file = $task['task_results'][$result_id]['amazons3'];
|
1218 |
$args = $task['task_args']['account_info']['iwp_amazon_s3'];
|
1219 |
$args['backup_file'] = $amazons3_file;
|
1220 |
+
iwp_mmb_print_flush('Amazon S3 download: Start');
|
1221 |
$backup_file = $this->get_amazons3_backup($args);
|
1222 |
+
iwp_mmb_print_flush('Amazon S3 download: End');
|
1223 |
if ($backup_file == false) {
|
1224 |
return array(
|
1225 |
'error' => 'Failed to download file from Amazon S3.'
|
1229 |
$dropbox_file = $task['task_results'][$result_id]['dropbox'];
|
1230 |
$args = $task['task_args']['account_info']['iwp_dropbox'];
|
1231 |
$args['backup_file'] = $dropbox_file;
|
1232 |
+
iwp_mmb_print_flush('Dropbox download: Start');
|
1233 |
$backup_file = $this->get_dropbox_backup($args);
|
1234 |
+
iwp_mmb_print_flush('Dropbox download: End');
|
1235 |
|
1236 |
if ($backup_file == false) {
|
1237 |
return array(
|
1288 |
chdir(ABSPATH);
|
1289 |
$unzip = $this->get_unzip();
|
1290 |
$command = "$unzip -o $backup_file";
|
1291 |
+
iwp_mmb_print_flush('ZIP Extract CMD: Start');
|
1292 |
ob_start();
|
1293 |
$result = $this->iwp_mmb_exec($command);
|
1294 |
ob_get_clean();
|
1295 |
+
iwp_mmb_print_flush('ZIP Extract CMD: End');
|
1296 |
|
1297 |
if (!$result) { //fallback to pclzip
|
1298 |
define('PCLZIP_TEMPORARY_DIR', IWP_BACKUP_DIR . '/');
|
1299 |
//require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
|
1300 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/pclzip.class.php';
|
1301 |
+
iwp_mmb_print_flush('ZIP Extract PCL: Start');
|
1302 |
$archive = new IWPPclZip($backup_file);
|
1303 |
$result = $archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
|
1304 |
+
iwp_mmb_print_flush('ZIP Extract PCL: End');
|
1305 |
}
|
1306 |
$this->wpdb_reconnect();
|
1307 |
|
1463 |
|
1464 |
$brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
|
1465 |
$command = $brace . $paths['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --default-character-set="utf8" ' . DB_NAME . ' < ' . $brace . $file_name . $brace;
|
1466 |
+
iwp_mmb_print_flush('DB Restore CMD: Start');
|
1467 |
ob_start();
|
1468 |
$result = $this->iwp_mmb_exec($command);
|
1469 |
ob_get_clean();
|
1470 |
+
iwp_mmb_print_flush('DB Restore CMD: End');
|
1471 |
if (!$result) {
|
1472 |
//try php
|
1473 |
$this->restore_db_php($file_name);
|
1490 |
// Loop through each line
|
1491 |
if(!empty($lines)){
|
1492 |
foreach ($lines as $line) {
|
1493 |
+
iwp_mmb_auto_print('restore_db_php');
|
1494 |
// Skip it if it's a comment
|
1495 |
if (substr($line, 0, 2) == '--' || $line == '')
|
1496 |
continue;
|
1943 |
$temp = ABSPATH . 'iwp_temp_backup.zip';
|
1944 |
|
1945 |
try {
|
1946 |
+
|
1947 |
+
$file = $dropbox->download($dropbox_destination.'/'.$backup_file);
|
1948 |
+
$handle = @fopen($temp, 'w');
|
1949 |
+
$result = fwrite($handle, $file);
|
1950 |
fclose($handle);
|
1951 |
|
1952 |
if($result)
|
core.class.php
CHANGED
@@ -1,746 +1,762 @@
|
|
1 |
-
<?php
|
2 |
-
/************************************************************
|
3 |
-
* This plugin was modified by Revmakx *
|
4 |
-
* Copyright (c) 2012 Revmakx *
|
5 |
-
* www.revmakx.com *
|
6 |
-
* *
|
7 |
-
************************************************************/
|
8 |
-
/*************************************************************
|
9 |
-
*
|
10 |
-
* core.class.php
|
11 |
-
*
|
12 |
-
* Upgrade Plugins
|
13 |
-
*
|
14 |
-
*
|
15 |
-
* Copyright (c) 2011 Prelovac Media
|
16 |
-
* www.prelovac.com
|
17 |
-
**************************************************************/
|
18 |
-
|
19 |
-
class IWP_MMB_Core extends IWP_MMB_Helper
|
20 |
-
{
|
21 |
-
var $name;
|
22 |
-
var $slug;
|
23 |
-
var $settings;
|
24 |
-
var $remote_client;
|
25 |
-
var $comment_instance;
|
26 |
-
var $plugin_instance;
|
27 |
-
var $theme_instance;
|
28 |
-
var $wp_instance;
|
29 |
-
var $post_instance;
|
30 |
-
var $stats_instance;
|
31 |
-
var $search_instance;
|
32 |
-
var $links_instance;
|
33 |
-
var $user_instance;
|
34 |
-
var $backup_instance;
|
35 |
-
var $installer_instance;
|
36 |
-
var $iwp_mmb_multisite;
|
37 |
-
var $network_admin_install;
|
38 |
-
|
39 |
-
var $backup_repository_instance;
|
40 |
-
var $optimize_instance;
|
41 |
-
|
42 |
-
private $action_call;
|
43 |
-
private $action_params;
|
44 |
-
private $iwp_mmb_pre_init_actions;
|
45 |
-
private $iwp_mmb_pre_init_filters;
|
46 |
-
private $iwp_mmb_init_actions;
|
47 |
-
|
48 |
-
|
49 |
-
function __construct()
|
50 |
-
{
|
51 |
-
global $iwp_mmb_plugin_dir, $wpmu_version, $blog_id, $_iwp_mmb_plugin_actions, $_iwp_mmb_item_filter;
|
52 |
-
|
53 |
-
$_iwp_mmb_plugin_actions = array();
|
54 |
-
$this->name = 'Manage Multiple Blogs';
|
55 |
-
$this->slug = 'manage-multiple-blogs';
|
56 |
-
$this->action_call = null;
|
57 |
-
$this->action_params = null;
|
58 |
-
|
59 |
-
|
60 |
-
$this->settings = get_option($this->slug);
|
61 |
-
if (!$this->settings) {
|
62 |
-
$this->settings = array(
|
63 |
-
'blogs' => array(),
|
64 |
-
'current_blog' => array(
|
65 |
-
'type' => null
|
66 |
-
)
|
67 |
-
);
|
68 |
-
$this->save_options();
|
69 |
-
}
|
70 |
-
if ( function_exists('is_multisite') ) {
|
71 |
-
if ( is_multisite() ) {
|
72 |
-
$this->iwp_mmb_multisite = $blog_id;
|
73 |
-
$this->network_admin_install = get_option('iwp_client_network_admin_install');
|
74 |
-
}
|
75 |
-
} else if (!empty($wpmu_version)) {
|
76 |
-
$this->iwp_mmb_multisite = $blog_id;
|
77 |
-
$this->network_admin_install = get_option('iwp_client_network_admin_install');
|
78 |
-
} else {
|
79 |
-
$this->iwp_mmb_multisite = false;
|
80 |
-
$this->network_admin_install = null;
|
81 |
-
}
|
82 |
-
|
83 |
-
// admin notices
|
84 |
-
if ( !get_option('iwp_client_public_key') ){
|
85 |
-
if( $this->iwp_mmb_multisite ){
|
86 |
-
if( is_network_admin() && $this->network_admin_install == '1'){
|
87 |
-
add_action('network_admin_notices', array( &$this, 'network_admin_notice' ));
|
88 |
-
} else if( $this->network_admin_install != '1' ){
|
89 |
-
//$parent_key = $this->get_parent_blog_option('iwp_client_public_key');//IWP commented to show notice to all subsites of network
|
90 |
-
//if(empty($parent_key))//IWP commented to show notice to all subsites of network
|
91 |
-
add_action('admin_notices', array( &$this, 'admin_notice' ));
|
92 |
-
}
|
93 |
-
} else {
|
94 |
-
add_action('admin_notices', array( &$this, 'admin_notice' ));
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
// default filters
|
99 |
-
//$this->iwp_mmb_pre_init_filters['get_stats']['iwp_mmb_stats_filter'][] = array('IWP_MMB_Stats', 'pre_init_stats'); // called with class name, use global $iwp_mmb_core inside the function instead of $this
|
100 |
-
$this->iwp_mmb_pre_init_filters['get_stats']['iwp_mmb_stats_filter'][] = 'iwp_mmb_pre_init_stats';
|
101 |
-
|
102 |
-
$_iwp_mmb_item_filter['pre_init_stats'] = array( 'core_update', 'hit_counter', 'comments', 'backups', 'posts', 'drafts', 'scheduled' );
|
103 |
-
$_iwp_mmb_item_filter['get'] = array( 'updates', 'errors' );
|
104 |
-
|
105 |
-
$this->iwp_mmb_pre_init_actions = array(
|
106 |
-
'backup_req' => 'iwp_mmb_get_backup_req',
|
107 |
-
);
|
108 |
-
|
109 |
-
$this->iwp_mmb_init_actions = array(
|
110 |
-
'do_upgrade' => 'iwp_mmb_do_upgrade',
|
111 |
-
'get_stats' => 'iwp_mmb_stats_get',
|
112 |
-
'remove_site' => 'iwp_mmb_remove_site',
|
113 |
-
'backup_clone' => 'iwp_mmb_backup_now',
|
114 |
-
'restore' => 'iwp_mmb_restore_now',
|
115 |
-
'optimize_tables' => 'iwp_mmb_optimize_tables',
|
116 |
-
'check_wp_version' => 'iwp_mmb_wp_checkversion',
|
117 |
-
'create_post' => 'iwp_mmb_post_create',
|
118 |
-
'update_client' => 'iwp_mmb_update_client_plugin',
|
119 |
-
|
120 |
-
'change_comment_status' => 'iwp_mmb_change_comment_status',
|
121 |
-
'change_post_status' => 'iwp_mmb_change_post_status',
|
122 |
-
'get_comment_stats' => 'iwp_mmb_comment_stats_get',
|
123 |
-
|
124 |
-
'get_links' => 'iwp_mmb_get_links',
|
125 |
-
'add_link' => 'iwp_mmb_add_link',
|
126 |
-
'delete_link' => 'iwp_mmb_delete_link',
|
127 |
-
'delete_links' => 'iwp_mmb_delete_links',
|
128 |
-
|
129 |
-
'create_post' => 'iwp_mmb_post_create',
|
130 |
-
'change_post_status' => 'iwp_mmb_change_post_status',
|
131 |
-
'get_posts' => 'iwp_mmb_get_posts',
|
132 |
-
'delete_post' => 'iwp_mmb_delete_post',
|
133 |
-
'delete_posts' => 'iwp_mmb_delete_posts',
|
134 |
-
'edit_posts' => 'iwp_mmb_edit_posts',
|
135 |
-
'get_pages' => 'iwp_mmb_get_pages',
|
136 |
-
'delete_page' => 'iwp_mmb_delete_page',
|
137 |
-
|
138 |
-
'install_addon' => 'iwp_mmb_install_addon',
|
139 |
-
'add_link' => 'iwp_mmb_add_link',
|
140 |
-
'add_user' => 'iwp_mmb_add_user',
|
141 |
-
'email_backup' => 'iwp_mmb_email_backup',
|
142 |
-
'check_backup_compat' => 'iwp_mmb_check_backup_compat',
|
143 |
-
'scheduled_backup' => 'iwp_mmb_scheduled_backup',
|
144 |
-
'run_task' => 'iwp_mmb_run_task_now',
|
145 |
-
'delete_schedule_task' => 'iwp_mmb_delete_task_now',
|
146 |
-
'execute_php_code' => 'iwp_mmb_execute_php_code',
|
147 |
-
'delete_backup' => '
|
148 |
-
'remote_backup_now' => 'iwp_mmb_remote_backup_now',
|
149 |
-
'set_notifications' => 'iwp_mmb_set_notifications',
|
150 |
-
'clean_orphan_backups' => 'iwp_mmb_clean_orphan_backups',
|
151 |
-
'get_users' => 'iwp_mmb_get_users',
|
152 |
-
'edit_users' => 'iwp_mmb_edit_users',
|
153 |
-
'get_plugins_themes' => 'iwp_mmb_get_plugins_themes',
|
154 |
-
'edit_plugins_themes' => 'iwp_mmb_edit_plugins_themes',
|
155 |
-
'get_comments' => 'iwp_mmb_get_comments',
|
156 |
-
'action_comment' => 'iwp_mmb_action_comment',
|
157 |
-
'bulk_action_comments' => 'iwp_mmb_bulk_action_comments',
|
158 |
-
'replyto_comment' => 'iwp_mmb_reply_comment',
|
159 |
-
'client_brand' => 'iwp_mmb_client_brand',
|
160 |
-
'set_alerts' => 'iwp_mmb_set_alerts',
|
161 |
-
'maintenance' => 'iwp_mmb_maintenance_mode',
|
162 |
-
|
163 |
-
'
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
add_action('
|
169 |
-
add_action('
|
170 |
-
add_action('
|
171 |
-
add_action('
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
$data = call_user_func( $_callback, $params );
|
204 |
-
}
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
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 |
-
<tr><td align="right">
|
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 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
*
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
if ($this->
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
if ($this->
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
}
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
*
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
if((
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
746 |
?>
|
1 |
+
<?php
|
2 |
+
/************************************************************
|
3 |
+
* This plugin was modified by Revmakx *
|
4 |
+
* Copyright (c) 2012 Revmakx *
|
5 |
+
* www.revmakx.com *
|
6 |
+
* *
|
7 |
+
************************************************************/
|
8 |
+
/*************************************************************
|
9 |
+
*
|
10 |
+
* core.class.php
|
11 |
+
*
|
12 |
+
* Upgrade Plugins
|
13 |
+
*
|
14 |
+
*
|
15 |
+
* Copyright (c) 2011 Prelovac Media
|
16 |
+
* www.prelovac.com
|
17 |
+
**************************************************************/
|
18 |
+
|
19 |
+
class IWP_MMB_Core extends IWP_MMB_Helper
|
20 |
+
{
|
21 |
+
var $name;
|
22 |
+
var $slug;
|
23 |
+
var $settings;
|
24 |
+
var $remote_client;
|
25 |
+
var $comment_instance;
|
26 |
+
var $plugin_instance;
|
27 |
+
var $theme_instance;
|
28 |
+
var $wp_instance;
|
29 |
+
var $post_instance;
|
30 |
+
var $stats_instance;
|
31 |
+
var $search_instance;
|
32 |
+
var $links_instance;
|
33 |
+
var $user_instance;
|
34 |
+
var $backup_instance;
|
35 |
+
var $installer_instance;
|
36 |
+
var $iwp_mmb_multisite;
|
37 |
+
var $network_admin_install;
|
38 |
+
|
39 |
+
var $backup_repository_instance;
|
40 |
+
var $optimize_instance;
|
41 |
+
|
42 |
+
private $action_call;
|
43 |
+
private $action_params;
|
44 |
+
private $iwp_mmb_pre_init_actions;
|
45 |
+
private $iwp_mmb_pre_init_filters;
|
46 |
+
private $iwp_mmb_init_actions;
|
47 |
+
|
48 |
+
|
49 |
+
function __construct()
|
50 |
+
{
|
51 |
+
global $iwp_mmb_plugin_dir, $wpmu_version, $blog_id, $_iwp_mmb_plugin_actions, $_iwp_mmb_item_filter;
|
52 |
+
|
53 |
+
$_iwp_mmb_plugin_actions = array();
|
54 |
+
$this->name = 'Manage Multiple Blogs';
|
55 |
+
$this->slug = 'manage-multiple-blogs';
|
56 |
+
$this->action_call = null;
|
57 |
+
$this->action_params = null;
|
58 |
+
|
59 |
+
|
60 |
+
$this->settings = get_option($this->slug);
|
61 |
+
if (!$this->settings) {
|
62 |
+
$this->settings = array(
|
63 |
+
'blogs' => array(),
|
64 |
+
'current_blog' => array(
|
65 |
+
'type' => null
|
66 |
+
)
|
67 |
+
);
|
68 |
+
$this->save_options();
|
69 |
+
}
|
70 |
+
if ( function_exists('is_multisite') ) {
|
71 |
+
if ( is_multisite() ) {
|
72 |
+
$this->iwp_mmb_multisite = $blog_id;
|
73 |
+
$this->network_admin_install = get_option('iwp_client_network_admin_install');
|
74 |
+
}
|
75 |
+
} else if (!empty($wpmu_version)) {
|
76 |
+
$this->iwp_mmb_multisite = $blog_id;
|
77 |
+
$this->network_admin_install = get_option('iwp_client_network_admin_install');
|
78 |
+
} else {
|
79 |
+
$this->iwp_mmb_multisite = false;
|
80 |
+
$this->network_admin_install = null;
|
81 |
+
}
|
82 |
+
|
83 |
+
// admin notices
|
84 |
+
if ( !get_option('iwp_client_public_key') ){
|
85 |
+
if( $this->iwp_mmb_multisite ){
|
86 |
+
if( is_network_admin() && $this->network_admin_install == '1'){
|
87 |
+
add_action('network_admin_notices', array( &$this, 'network_admin_notice' ));
|
88 |
+
} else if( $this->network_admin_install != '1' ){
|
89 |
+
//$parent_key = $this->get_parent_blog_option('iwp_client_public_key');//IWP commented to show notice to all subsites of network
|
90 |
+
//if(empty($parent_key))//IWP commented to show notice to all subsites of network
|
91 |
+
add_action('admin_notices', array( &$this, 'admin_notice' ));
|
92 |
+
}
|
93 |
+
} else {
|
94 |
+
add_action('admin_notices', array( &$this, 'admin_notice' ));
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
// default filters
|
99 |
+
//$this->iwp_mmb_pre_init_filters['get_stats']['iwp_mmb_stats_filter'][] = array('IWP_MMB_Stats', 'pre_init_stats'); // called with class name, use global $iwp_mmb_core inside the function instead of $this
|
100 |
+
$this->iwp_mmb_pre_init_filters['get_stats']['iwp_mmb_stats_filter'][] = 'iwp_mmb_pre_init_stats';
|
101 |
+
|
102 |
+
$_iwp_mmb_item_filter['pre_init_stats'] = array( 'core_update', 'hit_counter', 'comments', 'backups', 'posts', 'drafts', 'scheduled' );
|
103 |
+
$_iwp_mmb_item_filter['get'] = array( 'updates', 'errors' );
|
104 |
+
|
105 |
+
$this->iwp_mmb_pre_init_actions = array(
|
106 |
+
'backup_req' => 'iwp_mmb_get_backup_req',
|
107 |
+
);
|
108 |
+
|
109 |
+
$this->iwp_mmb_init_actions = array(
|
110 |
+
'do_upgrade' => 'iwp_mmb_do_upgrade',
|
111 |
+
'get_stats' => 'iwp_mmb_stats_get',
|
112 |
+
'remove_site' => 'iwp_mmb_remove_site',
|
113 |
+
'backup_clone' => 'iwp_mmb_backup_now',
|
114 |
+
'restore' => 'iwp_mmb_restore_now',
|
115 |
+
'optimize_tables' => 'iwp_mmb_optimize_tables',
|
116 |
+
'check_wp_version' => 'iwp_mmb_wp_checkversion',
|
117 |
+
'create_post' => 'iwp_mmb_post_create',
|
118 |
+
'update_client' => 'iwp_mmb_update_client_plugin',
|
119 |
+
|
120 |
+
'change_comment_status' => 'iwp_mmb_change_comment_status',
|
121 |
+
'change_post_status' => 'iwp_mmb_change_post_status',
|
122 |
+
'get_comment_stats' => 'iwp_mmb_comment_stats_get',
|
123 |
+
|
124 |
+
'get_links' => 'iwp_mmb_get_links',
|
125 |
+
'add_link' => 'iwp_mmb_add_link',
|
126 |
+
'delete_link' => 'iwp_mmb_delete_link',
|
127 |
+
'delete_links' => 'iwp_mmb_delete_links',
|
128 |
+
|
129 |
+
'create_post' => 'iwp_mmb_post_create',
|
130 |
+
'change_post_status' => 'iwp_mmb_change_post_status',
|
131 |
+
'get_posts' => 'iwp_mmb_get_posts',
|
132 |
+
'delete_post' => 'iwp_mmb_delete_post',
|
133 |
+
'delete_posts' => 'iwp_mmb_delete_posts',
|
134 |
+
'edit_posts' => 'iwp_mmb_edit_posts',
|
135 |
+
'get_pages' => 'iwp_mmb_get_pages',
|
136 |
+
'delete_page' => 'iwp_mmb_delete_page',
|
137 |
+
|
138 |
+
'install_addon' => 'iwp_mmb_install_addon',
|
139 |
+
'add_link' => 'iwp_mmb_add_link',
|
140 |
+
'add_user' => 'iwp_mmb_add_user',
|
141 |
+
'email_backup' => 'iwp_mmb_email_backup',
|
142 |
+
'check_backup_compat' => 'iwp_mmb_check_backup_compat',
|
143 |
+
'scheduled_backup' => 'iwp_mmb_scheduled_backup',
|
144 |
+
'run_task' => 'iwp_mmb_run_task_now',
|
145 |
+
'delete_schedule_task' => 'iwp_mmb_delete_task_now',
|
146 |
+
'execute_php_code' => 'iwp_mmb_execute_php_code',
|
147 |
+
'delete_backup' => 'iwp_mmb_delete_backup',
|
148 |
+
'remote_backup_now' => 'iwp_mmb_remote_backup_now',
|
149 |
+
'set_notifications' => 'iwp_mmb_set_notifications',
|
150 |
+
'clean_orphan_backups' => 'iwp_mmb_clean_orphan_backups',
|
151 |
+
'get_users' => 'iwp_mmb_get_users',
|
152 |
+
'edit_users' => 'iwp_mmb_edit_users',
|
153 |
+
'get_plugins_themes' => 'iwp_mmb_get_plugins_themes',
|
154 |
+
'edit_plugins_themes' => 'iwp_mmb_edit_plugins_themes',
|
155 |
+
'get_comments' => 'iwp_mmb_get_comments',
|
156 |
+
'action_comment' => 'iwp_mmb_action_comment',
|
157 |
+
'bulk_action_comments' => 'iwp_mmb_bulk_action_comments',
|
158 |
+
'replyto_comment' => 'iwp_mmb_reply_comment',
|
159 |
+
'client_brand' => 'iwp_mmb_client_brand',
|
160 |
+
'set_alerts' => 'iwp_mmb_set_alerts',
|
161 |
+
'maintenance' => 'iwp_mmb_maintenance_mode',
|
162 |
+
|
163 |
+
'wp_optimize' => 'iwp_mmb_wp_optimize',
|
164 |
+
|
165 |
+
'backup_repository' => 'iwp_mmb_backup_repository'
|
166 |
+
);
|
167 |
+
|
168 |
+
add_action('rightnow_end', array( &$this, 'add_right_now_info' ));
|
169 |
+
add_action('admin_init', array(&$this,'admin_actions'));
|
170 |
+
add_action('init', array( &$this, 'iwp_mmb_remote_action'), 9999);
|
171 |
+
add_action('setup_theme', 'iwp_mmb_parse_request');
|
172 |
+
add_action('set_auth_cookie', array( &$this, 'iwp_mmb_set_auth_cookie'));
|
173 |
+
add_action('set_logged_in_cookie', array( &$this, 'iwp_mmb_set_logged_in_cookie'));
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
function iwp_mmb_remote_action(){
|
178 |
+
if($this->action_call != null){
|
179 |
+
$params = isset($this->action_params) && $this->action_params != null ? $this->action_params : array();
|
180 |
+
call_user_func($this->action_call, $params);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
function register_action_params( $action = false, $params = array() ){
|
185 |
+
|
186 |
+
if(isset($this->iwp_mmb_pre_init_actions[$action]) && function_exists($this->iwp_mmb_pre_init_actions[$action])){
|
187 |
+
call_user_func($this->iwp_mmb_pre_init_actions[$action], $params);
|
188 |
+
}
|
189 |
+
|
190 |
+
if(isset($this->iwp_mmb_init_actions[$action]) && function_exists($this->iwp_mmb_init_actions[$action])){
|
191 |
+
$this->action_call = $this->iwp_mmb_init_actions[$action];
|
192 |
+
$this->action_params = $params;
|
193 |
+
|
194 |
+
if( isset($this->iwp_mmb_pre_init_filters[$action]) && !empty($this->iwp_mmb_pre_init_filters[$action])){
|
195 |
+
global $iwp_mmb_filters;
|
196 |
+
|
197 |
+
foreach($this->iwp_mmb_pre_init_filters[$action] as $_name => $_functions){
|
198 |
+
if(!empty($_functions)){
|
199 |
+
$data = array();
|
200 |
+
|
201 |
+
foreach($_functions as $_k => $_callback){
|
202 |
+
if(is_array($_callback) && method_exists($_callback[0], $_callback[1]) ){
|
203 |
+
$data = call_user_func( $_callback, $params );
|
204 |
+
} elseif (is_string($_callback) && function_exists( $_callback )){
|
205 |
+
$data = call_user_func( $_callback, $params );
|
206 |
+
}
|
207 |
+
$iwp_mmb_filters[$_name] = isset($iwp_mmb_filters[$_name]) && !empty($iwp_mmb_filters[$_name]) ? array_merge($iwp_mmb_filters[$_name], $data) : $data;
|
208 |
+
add_filter( $_name, create_function( '$a' , 'global $iwp_mmb_filters; return array_merge($a, $iwp_mmb_filters["'.$_name.'"]);') );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
}
|
213 |
+
}
|
214 |
+
return true;
|
215 |
+
}
|
216 |
+
return false;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Add notice to network admin dashboard for security reasons
|
221 |
+
*
|
222 |
+
*/
|
223 |
+
function network_admin_notice()
|
224 |
+
{
|
225 |
+
echo '<div class="error" style="text-align: center;"><p style="font-size: 14px; font-weight: bold; color:#c00;">Attention !</p>
|
226 |
+
<p>The InfiniteWP client plugin has to be activated on individual sites. Kindly deactivate the plugin from the network admin dashboard and activate them from the individual dashboards.</p></div>';
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Add notice to admin dashboard for security reasons
|
232 |
+
*
|
233 |
+
*/
|
234 |
+
function admin_notice()
|
235 |
+
{
|
236 |
+
/* IWP */
|
237 |
+
if(defined('MULTISITE') && MULTISITE == true){
|
238 |
+
global $blog_id;
|
239 |
+
$user_id_from_email = get_user_id_from_string( get_blog_option($blog_id, 'admin_email'));
|
240 |
+
$details = get_userdata($user_id_from_email);
|
241 |
+
$username = $details->user_login;
|
242 |
+
}
|
243 |
+
else{
|
244 |
+
$current_user = wp_get_current_user();
|
245 |
+
$username = $current_user->data->user_login;
|
246 |
+
}
|
247 |
+
|
248 |
+
$iwp_client_activate_key = get_option('iwp_client_activate_key');
|
249 |
+
|
250 |
+
//check BWP
|
251 |
+
$bwp = get_option("bit51_bwps");
|
252 |
+
$notice_display_URL=admin_url();
|
253 |
+
if(!empty($bwp))
|
254 |
+
{
|
255 |
+
//$bwpArray = @unserialize($bwp);
|
256 |
+
if($bwp['hb_enabled']==1)
|
257 |
+
$notice_display_URL = get_option('home');
|
258 |
+
}
|
259 |
+
|
260 |
+
$notice_display_URL = rtrim($notice_display_URL, '/').'/';
|
261 |
+
|
262 |
+
|
263 |
+
echo '<div class="updated" style="text-align: center;"><p style="color: green; font-size: 14px; font-weight: bold;">Add this site to IWP Admin panel</p><p>
|
264 |
+
<table border="0" align="center">';
|
265 |
+
if(!empty($iwp_client_activate_key)){
|
266 |
+
echo '<tr><td align="right">WP-ADMIN URL:</td><td align="left"><strong>'.$notice_display_URL.'</strong></td></tr>
|
267 |
+
<tr><td align="right">ADMIN USERNAME:</td><td align="left"><strong>'.$username.'</strong> (or any admin id)</td></tr>
|
268 |
+
<tr><td align="right">ACTIVATION KEY:</td><td align="left"><strong>'.$iwp_client_activate_key.'</strong></td></tr>';
|
269 |
+
}
|
270 |
+
else{
|
271 |
+
echo '<tr><td align="center">Please deactivate and then activate InfiniteWP Client plugin.</td></tr>';
|
272 |
+
}
|
273 |
+
|
274 |
+
echo '</table>
|
275 |
+
</p></div>';
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Add an item into the Right Now Dashboard widget
|
281 |
+
* to inform that the blog can be managed remotely
|
282 |
+
*
|
283 |
+
*/
|
284 |
+
function add_right_now_info()
|
285 |
+
{
|
286 |
+
echo '<div class="iwp_mmb-slave-info">
|
287 |
+
<p>This site can be managed remotely.</p>
|
288 |
+
</div>';
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Get parent blog options
|
293 |
+
*
|
294 |
+
*/
|
295 |
+
private function get_parent_blog_option( $option_name = '' )
|
296 |
+
{
|
297 |
+
global $wpdb;
|
298 |
+
$option = $wpdb->get_var( $wpdb->prepare( "SELECT `option_value` FROM {$wpdb->base_prefix}options WHERE option_name = %s LIMIT 1", $option_name ) );
|
299 |
+
return $option;
|
300 |
+
}
|
301 |
+
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Gets an instance of the WP_Optimize class
|
305 |
+
*
|
306 |
+
*/
|
307 |
+
function wp_optimize_instance()
|
308 |
+
{
|
309 |
+
if (!isset($this->optimize_instance)) {
|
310 |
+
$this->optimize_instance = new IWP_MMB_Optimize();
|
311 |
+
}
|
312 |
+
|
313 |
+
return $this->optimize_instance;
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Gets an instance of the Comment class
|
318 |
+
*
|
319 |
+
*/
|
320 |
+
function get_comment_instance()
|
321 |
+
{
|
322 |
+
if (!isset($this->comment_instance)) {
|
323 |
+
$this->comment_instance = new IWP_MMB_Comment();
|
324 |
+
}
|
325 |
+
|
326 |
+
return $this->comment_instance;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Gets an instance of the Plugin class
|
331 |
+
*
|
332 |
+
*/
|
333 |
+
function get_plugin_instance()
|
334 |
+
{
|
335 |
+
if (!isset($this->plugin_instance)) {
|
336 |
+
$this->plugin_instance = new IWP_MMB_Plugin();
|
337 |
+
}
|
338 |
+
|
339 |
+
return $this->plugin_instance;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Gets an instance of the Theme class
|
344 |
+
*
|
345 |
+
*/
|
346 |
+
function get_theme_instance()
|
347 |
+
{
|
348 |
+
if (!isset($this->theme_instance)) {
|
349 |
+
$this->theme_instance = new IWP_MMB_Theme();
|
350 |
+
}
|
351 |
+
|
352 |
+
return $this->theme_instance;
|
353 |
+
}
|
354 |
+
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Gets an instance of IWP_MMB_Post class
|
358 |
+
*
|
359 |
+
*/
|
360 |
+
function get_post_instance()
|
361 |
+
{
|
362 |
+
if (!isset($this->post_instance)) {
|
363 |
+
$this->post_instance = new IWP_MMB_Post();
|
364 |
+
}
|
365 |
+
|
366 |
+
return $this->post_instance;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Gets an instance of Blogroll class
|
371 |
+
*
|
372 |
+
*/
|
373 |
+
function get_blogroll_instance()
|
374 |
+
{
|
375 |
+
if (!isset($this->blogroll_instance)) {
|
376 |
+
$this->blogroll_instance = new IWP_MMB_Blogroll();
|
377 |
+
}
|
378 |
+
|
379 |
+
return $this->blogroll_instance;
|
380 |
+
}
|
381 |
+
|
382 |
+
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Gets an instance of the WP class
|
386 |
+
*
|
387 |
+
*/
|
388 |
+
function get_wp_instance()
|
389 |
+
{
|
390 |
+
if (!isset($this->wp_instance)) {
|
391 |
+
$this->wp_instance = new IWP_MMB_WP();
|
392 |
+
}
|
393 |
+
|
394 |
+
return $this->wp_instance;
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Gets an instance of User
|
399 |
+
*
|
400 |
+
*/
|
401 |
+
function get_user_instance()
|
402 |
+
{
|
403 |
+
if (!isset($this->user_instance)) {
|
404 |
+
$this->user_instance = new IWP_MMB_User();
|
405 |
+
}
|
406 |
+
|
407 |
+
return $this->user_instance;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Gets an instance of stats class
|
412 |
+
*
|
413 |
+
*/
|
414 |
+
function get_stats_instance()
|
415 |
+
{
|
416 |
+
if (!isset($this->stats_instance)) {
|
417 |
+
$this->stats_instance = new IWP_MMB_Stats();
|
418 |
+
}
|
419 |
+
return $this->stats_instance;
|
420 |
+
}
|
421 |
+
/**
|
422 |
+
* Gets an instance of search class
|
423 |
+
*
|
424 |
+
*/
|
425 |
+
function get_search_instance()
|
426 |
+
{
|
427 |
+
if (!isset($this->search_instance)) {
|
428 |
+
$this->search_instance = new IWP_MMB_Search();
|
429 |
+
}
|
430 |
+
//return $this->search_instance;
|
431 |
+
return $this->search_instance;
|
432 |
+
}
|
433 |
+
/**
|
434 |
+
* Gets an instance of stats class
|
435 |
+
*
|
436 |
+
*/
|
437 |
+
function get_backup_instance()
|
438 |
+
{
|
439 |
+
if (!isset($this->backup_instance)) {
|
440 |
+
$this->backup_instance = new IWP_MMB_Backup();
|
441 |
+
}
|
442 |
+
|
443 |
+
return $this->backup_instance;
|
444 |
+
}
|
445 |
+
|
446 |
+
function get_backup_repository_instance()
|
447 |
+
{
|
448 |
+
if (!isset($this->backup_repository_instance)) {
|
449 |
+
$this->backup_repository_instance = new IWP_MMB_Backup_Repository();
|
450 |
+
}
|
451 |
+
|
452 |
+
return $this->backup_repository_instance;
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Gets an instance of links class
|
457 |
+
*
|
458 |
+
*/
|
459 |
+
function get_link_instance()
|
460 |
+
{
|
461 |
+
if (!isset($this->link_instance)) {
|
462 |
+
$this->link_instance = new IWP_MMB_Link();
|
463 |
+
}
|
464 |
+
|
465 |
+
return $this->link_instance;
|
466 |
+
}
|
467 |
+
|
468 |
+
function get_installer_instance()
|
469 |
+
{
|
470 |
+
if (!isset($this->installer_instance)) {
|
471 |
+
$this->installer_instance = new IWP_MMB_Installer();
|
472 |
+
}
|
473 |
+
return $this->installer_instance;
|
474 |
+
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Plugin install callback function
|
478 |
+
* Check PHP version
|
479 |
+
*/
|
480 |
+
function install() {
|
481 |
+
|
482 |
+
global $wpdb, $_wp_using_ext_object_cache, $current_user;
|
483 |
+
$_wp_using_ext_object_cache = false;
|
484 |
+
|
485 |
+
//delete plugin options, just in case
|
486 |
+
if ($this->iwp_mmb_multisite != false) {
|
487 |
+
$network_blogs = $wpdb->get_results("select `blog_id`, `site_id` from `{$wpdb->blogs}`");
|
488 |
+
if(!empty($network_blogs)){
|
489 |
+
if( is_network_admin() ){
|
490 |
+
update_option('iwp_client_network_admin_install', 1);
|
491 |
+
foreach($network_blogs as $details){
|
492 |
+
if($details->site_id == $details->blog_id)
|
493 |
+
update_blog_option($details->blog_id, 'iwp_client_network_admin_install', 1);
|
494 |
+
else
|
495 |
+
update_blog_option($details->blog_id, 'iwp_client_network_admin_install', -1);
|
496 |
+
|
497 |
+
delete_blog_option($blog_id, 'iwp_client_nossl_key');
|
498 |
+
delete_blog_option($blog_id, 'iwp_client_public_key');
|
499 |
+
delete_blog_option($blog_id, 'iwp_client_action_message_id');
|
500 |
+
}
|
501 |
+
} else {
|
502 |
+
update_option('iwp_client_network_admin_install', -1);
|
503 |
+
delete_option('iwp_client_nossl_key');
|
504 |
+
delete_option('iwp_client_public_key');
|
505 |
+
delete_option('iwp_client_action_message_id');
|
506 |
+
}
|
507 |
+
}
|
508 |
+
} else {
|
509 |
+
delete_option('iwp_client_nossl_key');
|
510 |
+
delete_option('iwp_client_public_key');
|
511 |
+
delete_option('iwp_client_action_message_id');
|
512 |
+
}
|
513 |
+
|
514 |
+
//delete_option('iwp_client_backup_tasks');
|
515 |
+
delete_option('iwp_client_notifications');
|
516 |
+
delete_option('iwp_client_brand');
|
517 |
+
delete_option('iwp_client_pageview_alerts');
|
518 |
+
|
519 |
+
add_option('iwp_client_activate_key', sha1( rand(1, 99999). uniqid('', true) . get_option('siteurl') ) );
|
520 |
+
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Saves the (modified) options into the database
|
525 |
+
*
|
526 |
+
*/
|
527 |
+
function save_options()
|
528 |
+
{
|
529 |
+
if (get_option($this->slug)) {
|
530 |
+
update_option($this->slug, $this->settings);
|
531 |
+
} else {
|
532 |
+
add_option($this->slug, $this->settings);
|
533 |
+
}
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Deletes options for communication with IWP Admin panel
|
538 |
+
*
|
539 |
+
*/
|
540 |
+
function uninstall( $deactivate = false )
|
541 |
+
{
|
542 |
+
global $current_user, $wpdb, $_wp_using_ext_object_cache;
|
543 |
+
$_wp_using_ext_object_cache = false;
|
544 |
+
|
545 |
+
if ($this->iwp_mmb_multisite != false) {
|
546 |
+
$network_blogs = $wpdb->get_col("select `blog_id` from `{$wpdb->blogs}`");
|
547 |
+
if(!empty($network_blogs)){
|
548 |
+
if( is_network_admin() ){
|
549 |
+
if( $deactivate ) {
|
550 |
+
delete_option('iwp_client_network_admin_install');
|
551 |
+
foreach($network_blogs as $blog_id){
|
552 |
+
delete_blog_option($blog_id, 'iwp_client_network_admin_install');
|
553 |
+
delete_blog_option($blog_id, 'iwp_client_nossl_key');
|
554 |
+
delete_blog_option($blog_id, 'iwp_client_public_key');
|
555 |
+
delete_blog_option($blog_id, 'iwp_client_action_message_id');
|
556 |
+
delete_blog_option($blog_id, 'iwp_client_maintenace_mode');
|
557 |
+
}
|
558 |
+
}
|
559 |
+
} else {
|
560 |
+
if( $deactivate )
|
561 |
+
delete_option('iwp_client_network_admin_install');
|
562 |
+
|
563 |
+
delete_option('iwp_client_nossl_key');
|
564 |
+
delete_option('iwp_client_public_key');
|
565 |
+
delete_option('iwp_client_action_message_id');
|
566 |
+
}
|
567 |
+
}
|
568 |
+
} else {
|
569 |
+
delete_option('iwp_client_nossl_key');
|
570 |
+
delete_option('iwp_client_public_key');
|
571 |
+
delete_option('iwp_client_action_message_id');
|
572 |
+
}
|
573 |
+
|
574 |
+
//Delete options
|
575 |
+
delete_option('iwp_client_maintenace_mode');
|
576 |
+
//delete_option('iwp_client_backup_tasks');
|
577 |
+
wp_clear_scheduled_hook('iwp_client_backup_tasks');
|
578 |
+
delete_option('iwp_client_notifications');
|
579 |
+
wp_clear_scheduled_hook('iwp_client_notifications');
|
580 |
+
delete_option('iwp_client_brand');
|
581 |
+
delete_option('iwp_client_pageview_alerts');
|
582 |
+
|
583 |
+
delete_option('iwp_client_activate_key');
|
584 |
+
}
|
585 |
+
|
586 |
+
|
587 |
+
/**
|
588 |
+
* Constructs a url (for ajax purpose)
|
589 |
+
*
|
590 |
+
* @param mixed $base_page
|
591 |
+
*/
|
592 |
+
function construct_url($params = array(), $base_page = 'index.php')
|
593 |
+
{
|
594 |
+
$url = "$base_page?_wpnonce=" . wp_create_nonce($this->slug);
|
595 |
+
foreach ($params as $key => $value) {
|
596 |
+
$url .= "&$key=$value";
|
597 |
+
}
|
598 |
+
|
599 |
+
return $url;
|
600 |
+
}
|
601 |
+
|
602 |
+
/**
|
603 |
+
* Client update
|
604 |
+
*
|
605 |
+
*/
|
606 |
+
function update_client_plugin($params)
|
607 |
+
{
|
608 |
+
extract($params);
|
609 |
+
if ($download_url) {
|
610 |
+
@include_once ABSPATH . 'wp-admin/includes/file.php';
|
611 |
+
@include_once ABSPATH . 'wp-admin/includes/misc.php';
|
612 |
+
@include_once ABSPATH . 'wp-admin/includes/template.php';
|
613 |
+
@include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
614 |
+
@include_once ABSPATH . 'wp-admin/includes/screen.php';
|
615 |
+
|
616 |
+
if (!$this->is_server_writable()) {
|
617 |
+
return array(
|
618 |
+
'error' => 'Failed. please add FTP details for automatic upgrades.'
|
619 |
+
);
|
620 |
+
}
|
621 |
+
|
622 |
+
ob_start();
|
623 |
+
@unlink(dirname(__FILE__));
|
624 |
+
$upgrader = new Plugin_Upgrader();
|
625 |
+
$result = $upgrader->run(array(
|
626 |
+
'package' => $download_url,
|
627 |
+
'destination' => WP_PLUGIN_DIR,
|
628 |
+
'clear_destination' => true,
|
629 |
+
'clear_working' => true,
|
630 |
+
'hook_extra' => array(
|
631 |
+
'plugin' => 'iwp-client/init.php'
|
632 |
+
)
|
633 |
+
));
|
634 |
+
ob_end_clean();
|
635 |
+
@wp_update_plugins();
|
636 |
+
|
637 |
+
if (is_wp_error($result) || !$result) {
|
638 |
+
return array(
|
639 |
+
'error' => 'InfiniteWP Client plugin could not be updated.'
|
640 |
+
);
|
641 |
+
} else {
|
642 |
+
return array(
|
643 |
+
'success' => 'InfiniteWP Client plugin successfully updated.'
|
644 |
+
);
|
645 |
+
}
|
646 |
+
}
|
647 |
+
return array(
|
648 |
+
'error' => 'Bad download path for client installation file.'
|
649 |
+
);
|
650 |
+
}
|
651 |
+
|
652 |
+
/**
|
653 |
+
* Automatically logs in when called from IWP Admin panel
|
654 |
+
*
|
655 |
+
*/
|
656 |
+
function automatic_login()
|
657 |
+
{
|
658 |
+
$where = isset($_GET['iwp_goto']) ? $_GET['iwp_goto'] : false;
|
659 |
+
$username = isset($_GET['username']) ? $_GET['username'] : '';
|
660 |
+
$auto_login = isset($_GET['auto_login']) ? $_GET['auto_login'] : 0;
|
661 |
+
$_SERVER['HTTP_REFERER']='';
|
662 |
+
if( !function_exists('is_user_logged_in') )
|
663 |
+
include_once( ABSPATH.'wp-includes/pluggable.php' );
|
664 |
+
|
665 |
+
if (( $auto_login && strlen(trim($username)) && !is_user_logged_in() ) || (isset($this->iwp_mmb_multisite) && $this->iwp_mmb_multisite )) {
|
666 |
+
$signature = base64_decode($_GET['signature']);
|
667 |
+
$message_id = trim($_GET['message_id']);
|
668 |
+
|
669 |
+
$auth = $this->authenticate_message($where . $message_id, $signature, $message_id);
|
670 |
+
if ($auth === true) {
|
671 |
+
|
672 |
+
if (!headers_sent())
|
673 |
+
header('P3P: CP="CAO PSA OUR"');
|
674 |
+
|
675 |
+
if(!defined('IWP_MMB_USER_LOGIN'))
|
676 |
+
define('IWP_MMB_USER_LOGIN', true);
|
677 |
+
|
678 |
+
$siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
|
679 |
+
$user = $this->iwp_mmb_get_user_info($username);
|
680 |
+
wp_set_current_user($user->ID);
|
681 |
+
|
682 |
+
if(!defined('COOKIEHASH') || (isset($this->iwp_mmb_multisite) && $this->iwp_mmb_multisite) )
|
683 |
+
wp_cookie_constants();
|
684 |
+
|
685 |
+
wp_set_auth_cookie($user->ID);
|
686 |
+
@iwp_mmb_client_header();
|
687 |
+
|
688 |
+
if((isset($this->iwp_mmb_multisite) && $this->iwp_mmb_multisite ) || isset($_REQUEST['iwpredirect'])){
|
689 |
+
if(function_exists('wp_safe_redirect') && function_exists('admin_url')){
|
690 |
+
wp_safe_redirect(admin_url($where));
|
691 |
+
exit();
|
692 |
+
}
|
693 |
+
}
|
694 |
+
} else {
|
695 |
+
wp_die($auth['error']);
|
696 |
+
}
|
697 |
+
} elseif( is_user_logged_in() ) {
|
698 |
+
@iwp_mmb_client_header();
|
699 |
+
if(isset($_REQUEST['iwpredirect'])){
|
700 |
+
if(function_exists('wp_safe_redirect') && function_exists('admin_url')){
|
701 |
+
wp_safe_redirect(admin_url($where));
|
702 |
+
exit();
|
703 |
+
}
|
704 |
+
}
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
function iwp_mmb_set_auth_cookie( $auth_cookie ){
|
709 |
+
if(!defined('IWP_MMB_USER_LOGIN'))
|
710 |
+
return false;
|
711 |
+
|
712 |
+
if( !defined('COOKIEHASH') )
|
713 |
+
wp_cookie_constants();
|
714 |
+
|
715 |
+
$_COOKIE['wordpress_'.COOKIEHASH] = $auth_cookie;
|
716 |
+
|
717 |
+
}
|
718 |
+
function iwp_mmb_set_logged_in_cookie( $logged_in_cookie ){
|
719 |
+
if(!defined('IWP_MMB_USER_LOGIN'))
|
720 |
+
return false;
|
721 |
+
|
722 |
+
if( !defined('COOKIEHASH') )
|
723 |
+
wp_cookie_constants();
|
724 |
+
|
725 |
+
$_COOKIE['wordpress_logged_in_'.COOKIEHASH] = $logged_in_cookie;
|
726 |
+
}
|
727 |
+
|
728 |
+
function admin_actions(){
|
729 |
+
add_filter('all_plugins', array($this, 'client_replace'));
|
730 |
+
}
|
731 |
+
|
732 |
+
function client_replace($all_plugins){
|
733 |
+
$replace = get_option("iwp_client_brand");
|
734 |
+
if(is_array($replace)){
|
735 |
+
if($replace['name'] || $replace['desc'] || $replace['author'] || $replace['author_url']){
|
736 |
+
$all_plugins['iwp-client/init.php']['Name'] = $replace['name'];
|
737 |
+
$all_plugins['iwp-client/init.php']['Title'] = $replace['name'];
|
738 |
+
$all_plugins['iwp-client/init.php']['Description'] = $replace['desc'];
|
739 |
+
$all_plugins['iwp-client/init.php']['AuthorURI'] = $replace['author_url'];
|
740 |
+
$all_plugins['iwp-client/init.php']['Author'] = $replace['author'];
|
741 |
+
$all_plugins['iwp-client/init.php']['AuthorName'] = $replace['author'];
|
742 |
+
$all_plugins['iwp-client/init.php']['PluginURI'] = '';
|
743 |
+
}
|
744 |
+
|
745 |
+
if($replace['hide']){
|
746 |
+
if (!function_exists('get_plugins')) {
|
747 |
+
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
748 |
+
}
|
749 |
+
$activated_plugins = get_option('active_plugins');
|
750 |
+
if (!$activated_plugins)
|
751 |
+
$activated_plugins = array();
|
752 |
+
if(in_array('iwp-client/init.php',$activated_plugins))
|
753 |
+
unset($all_plugins['iwp-client/init.php']);
|
754 |
+
}
|
755 |
+
}
|
756 |
+
|
757 |
+
return $all_plugins;
|
758 |
+
}
|
759 |
+
|
760 |
+
|
761 |
+
}
|
762 |
?>
|
init.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: InfiniteWP - Client
|
|
4 |
Plugin URI: http://infinitewp.com/
|
5 |
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
|
6 |
Author: Revmakx
|
7 |
-
Version: 1.1.
|
8 |
Author URI: http://www.revmakx.com
|
9 |
*/
|
10 |
/************************************************************
|
@@ -14,7 +14,7 @@ Author URI: http://www.revmakx.com
|
|
14 |
* *
|
15 |
************************************************************/
|
16 |
|
17 |
-
|
18 |
*
|
19 |
* init.php
|
20 |
*
|
@@ -23,10 +23,10 @@ Author URI: http://www.revmakx.com
|
|
23 |
*
|
24 |
* Copyright (c) 2011 Prelovac Media
|
25 |
* www.prelovac.com
|
26 |
-
|
27 |
|
28 |
if(!defined('IWP_MMB_CLIENT_VERSION'))
|
29 |
-
define('IWP_MMB_CLIENT_VERSION', '1.1.
|
30 |
|
31 |
|
32 |
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
|
@@ -55,6 +55,8 @@ require_once("$iwp_mmb_plugin_dir/addons/comments/comments.class.php");
|
|
55 |
require_once("$iwp_mmb_plugin_dir/addons/post_links/link.class.php");
|
56 |
require_once("$iwp_mmb_plugin_dir/addons/post_links/post.class.php");
|
57 |
|
|
|
|
|
58 |
require_once("$iwp_mmb_plugin_dir/api.php");
|
59 |
require_once("$iwp_mmb_plugin_dir/plugins/search/search.php");
|
60 |
require_once("$iwp_mmb_plugin_dir/plugins/cleanup/cleanup.php");
|
@@ -87,8 +89,6 @@ if( !function_exists ( 'iwp_mmb_filter_params' )) {
|
|
87 |
if( !function_exists ('iwp_mmb_parse_request')) {
|
88 |
function iwp_mmb_parse_request()
|
89 |
{
|
90 |
-
|
91 |
-
|
92 |
if (!isset($HTTP_RAW_POST_DATA)) {
|
93 |
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
|
94 |
}
|
@@ -111,8 +111,11 @@ if( !function_exists ('iwp_mmb_parse_request')) {
|
|
111 |
}
|
112 |
|
113 |
if (isset($iwp_action)) {
|
114 |
-
if(!defined('IWP_AUTHORISED_CALL')) define('IWP_AUTHORISED_CALL', 1);
|
115 |
|
|
|
|
|
|
|
|
|
116 |
error_reporting(E_ALL ^ E_NOTICE);
|
117 |
@ini_set("display_errors", 1);
|
118 |
|
@@ -206,6 +209,7 @@ if( !function_exists ( 'iwp_mmb_response' )) {
|
|
206 |
header('HTTP/1.0 200 OK');
|
207 |
header('Content-Type: text/plain');
|
208 |
}
|
|
|
209 |
exit("<IWPHEADER>" . base64_encode(serialize($return))."<ENDIWPHEADER>");
|
210 |
}
|
211 |
}
|
@@ -425,8 +429,8 @@ if( !function_exists ( 'iwp_mmb_scheduled_backup' )) {
|
|
425 |
}
|
426 |
|
427 |
|
428 |
-
if( !function_exists ( '
|
429 |
-
function
|
430 |
{
|
431 |
global $iwp_mmb_core;
|
432 |
$iwp_mmb_core->get_backup_instance();
|
@@ -985,7 +989,23 @@ if( !function_exists ('iwp_mmb_reply_comment')) {
|
|
985 |
|
986 |
//Comments-End-
|
987 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
988 |
|
|
|
989 |
if( !function_exists('iwp_mmb_maintenance_mode')){
|
990 |
function iwp_mmb_maintenance_mode( $params ) {
|
991 |
global $wp_object_cache;
|
@@ -1091,6 +1111,66 @@ if(!function_exists('checkOpenSSL')){
|
|
1091 |
}
|
1092 |
}
|
1093 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1094 |
$iwp_mmb_core = new IWP_MMB_Core();
|
1095 |
$mmb_core = 1;
|
1096 |
|
4 |
Plugin URI: http://infinitewp.com/
|
5 |
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
|
6 |
Author: Revmakx
|
7 |
+
Version: 1.1.9
|
8 |
Author URI: http://www.revmakx.com
|
9 |
*/
|
10 |
/************************************************************
|
14 |
* *
|
15 |
************************************************************/
|
16 |
|
17 |
+
/*************************************************************
|
18 |
*
|
19 |
* init.php
|
20 |
*
|
23 |
*
|
24 |
* Copyright (c) 2011 Prelovac Media
|
25 |
* www.prelovac.com
|
26 |
+
**************************************************************/
|
27 |
|
28 |
if(!defined('IWP_MMB_CLIENT_VERSION'))
|
29 |
+
define('IWP_MMB_CLIENT_VERSION', '1.1.9');
|
30 |
|
31 |
|
32 |
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
|
55 |
require_once("$iwp_mmb_plugin_dir/addons/post_links/link.class.php");
|
56 |
require_once("$iwp_mmb_plugin_dir/addons/post_links/post.class.php");
|
57 |
|
58 |
+
require_once("$iwp_mmb_plugin_dir/addons/wp_optimize/optimize.class.php");
|
59 |
+
|
60 |
require_once("$iwp_mmb_plugin_dir/api.php");
|
61 |
require_once("$iwp_mmb_plugin_dir/plugins/search/search.php");
|
62 |
require_once("$iwp_mmb_plugin_dir/plugins/cleanup/cleanup.php");
|
89 |
if( !function_exists ('iwp_mmb_parse_request')) {
|
90 |
function iwp_mmb_parse_request()
|
91 |
{
|
|
|
|
|
92 |
if (!isset($HTTP_RAW_POST_DATA)) {
|
93 |
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
|
94 |
}
|
111 |
}
|
112 |
|
113 |
if (isset($iwp_action)) {
|
|
|
114 |
|
115 |
+
if(!defined('IWP_AUTHORISED_CALL')) define('IWP_AUTHORISED_CALL', 1);
|
116 |
+
if(function_exists('register_shutdown_function')){ register_shutdown_function("iwp_mmb_shutdown"); }
|
117 |
+
$GLOBALS['IWP_MMB_PROFILING']['ACTION_START'] = microtime(1);
|
118 |
+
|
119 |
error_reporting(E_ALL ^ E_NOTICE);
|
120 |
@ini_set("display_errors", 1);
|
121 |
|
209 |
header('HTTP/1.0 200 OK');
|
210 |
header('Content-Type: text/plain');
|
211 |
}
|
212 |
+
$GLOBALS['IWP_RESPONSE_SENT'] = true;
|
213 |
exit("<IWPHEADER>" . base64_encode(serialize($return))."<ENDIWPHEADER>");
|
214 |
}
|
215 |
}
|
429 |
}
|
430 |
|
431 |
|
432 |
+
if( !function_exists ( 'iwp_mmb_delete_backup' )) {
|
433 |
+
function iwp_mmb_delete_backup($params)
|
434 |
{
|
435 |
global $iwp_mmb_core;
|
436 |
$iwp_mmb_core->get_backup_instance();
|
989 |
|
990 |
//Comments-End-
|
991 |
|
992 |
+
//WP-Optimize
|
993 |
+
|
994 |
+
if( !function_exists('iwp_mmb_wp_optimize')){
|
995 |
+
function iwp_mmb_wp_optimize($params){
|
996 |
+
global $iwp_mmb_core;
|
997 |
+
$iwp_mmb_core->wp_optimize_instance();
|
998 |
+
|
999 |
+
$return = $iwp_mmb_core->optimize_instance->cleanup_system($params);
|
1000 |
+
if (is_array($return) && array_key_exists('error', $return))
|
1001 |
+
iwp_mmb_response($return['error'], false);
|
1002 |
+
else {
|
1003 |
+
iwp_mmb_response($return, true);
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
+
}
|
1007 |
|
1008 |
+
//WP-Optimize_end
|
1009 |
if( !function_exists('iwp_mmb_maintenance_mode')){
|
1010 |
function iwp_mmb_maintenance_mode( $params ) {
|
1011 |
global $wp_object_cache;
|
1111 |
}
|
1112 |
}
|
1113 |
|
1114 |
+
|
1115 |
+
if(!function_exists('iwp_mmb_shutdown')){
|
1116 |
+
function iwp_mmb_shutdown(){
|
1117 |
+
$isError = false;
|
1118 |
+
|
1119 |
+
if ($error = error_get_last()){
|
1120 |
+
switch($error['type']){
|
1121 |
+
/*case E_PARSE:*/
|
1122 |
+
case E_ERROR:
|
1123 |
+
case E_CORE_ERROR:
|
1124 |
+
case E_COMPILE_ERROR:
|
1125 |
+
case E_USER_ERROR:
|
1126 |
+
$isError = true;
|
1127 |
+
break;
|
1128 |
+
}
|
1129 |
+
}
|
1130 |
+
if ($isError){
|
1131 |
+
|
1132 |
+
$response = '<span style="font-weight:700;">PHP Fatal error occured:</span> '.$error['message'].' in '.$error['file'].' on line '.$error['line'].'.';
|
1133 |
+
if(stripos($error['message'], 'allowed memory size') !== false){
|
1134 |
+
$response .= '<br>Try <a href="http://infinitewp.com/knowledge-base/increase-memory-limit/?utm_source=application&utm_medium=userapp&utm_campaign=kb" target="_blank">increasing the PHP memory limit</a> for this WP site.';
|
1135 |
+
}
|
1136 |
+
if(!$GLOBALS['IWP_RESPONSE_SENT']){
|
1137 |
+
iwp_mmb_response($response, false);
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
}
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
|
1145 |
+
if(!function_exists('iwp_mmb_print_flush')){
|
1146 |
+
function iwp_mmb_print_flush($print_string){// this will help responding web server, will keep alive the script execution
|
1147 |
+
|
1148 |
+
echo $print_string." ||| ";
|
1149 |
+
echo "TT:".(microtime(1) - $GLOBALS['IWP_MMB_PROFILING']['ACTION_START'])."\n";
|
1150 |
+
ob_flush();
|
1151 |
+
flush();
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
if(!function_exists('iwp_mmb_auto_print')){
|
1156 |
+
function iwp_mmb_auto_print($unique_task){// this will help responding web server, will keep alive the script execution
|
1157 |
+
$print_every_x_secs = 20;
|
1158 |
+
|
1159 |
+
$current_time = microtime(1);
|
1160 |
+
if(!$GLOBALS['IWP_MMB_PROFILING']['TASKS'][$unique_task]['START']){
|
1161 |
+
$GLOBALS['IWP_MMB_PROFILING']['TASKS'][$unique_task]['START'] = $current_time;
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
if(!$GLOBALS['IWP_MMB_PROFILING']['LAST_PRINT'] || ($current_time - $GLOBALS['IWP_MMB_PROFILING']['LAST_PRINT']) > $print_every_x_secs){
|
1165 |
+
|
1166 |
+
//$print_string = "TT:".($current_time - $GLOBALS['IWP_MMB_PROFILING']['ACTION_START'])."\n";
|
1167 |
+
$print_string = $unique_task." TT:".($current_time - $GLOBALS['IWP_MMB_PROFILING']['TASKS'][$unique_task]['START']);
|
1168 |
+
iwp_mmb_print_flush($print_string);
|
1169 |
+
$GLOBALS['IWP_MMB_PROFILING']['LAST_PRINT'] = $current_time;
|
1170 |
+
}
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
|
1174 |
$iwp_mmb_core = new IWP_MMB_Core();
|
1175 |
$mmb_core = 1;
|
1176 |
|
lib/dropbox.php
CHANGED
@@ -49,7 +49,7 @@ class Dropbox {
|
|
49 |
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'files_put/'.$this->root.'/'.trim($path, '/');
|
50 |
$output = $this->request($url, array('overwrite' => ($overwrite)? 'true' : 'false'), 'PUT', $filehandle, $filesize);
|
51 |
fclose($filehandle);
|
52 |
-
} else {
|
53 |
$output = $this->chunked_upload($file, $path,$overwrite);
|
54 |
}
|
55 |
return $output;
|
@@ -64,6 +64,7 @@ class Dropbox {
|
|
64 |
$offset=0;
|
65 |
$ProgressFunction=null;
|
66 |
while ($data=fread($file_handle,4194304)) { //4194304 = 4MB
|
|
|
67 |
$chunkHandle = fopen('php://memory', 'rw');
|
68 |
fwrite($chunkHandle,$data);
|
69 |
rewind($chunkHandle);
|
@@ -215,6 +216,7 @@ class Dropbox {
|
|
215 |
$args = (is_array($args)) ? '?'.http_build_query($args, '', '&') : $args;
|
216 |
curl_setopt($ch, CURLOPT_URL, $url.$args);
|
217 |
}
|
|
|
218 |
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
219 |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
220 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
49 |
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'files_put/'.$this->root.'/'.trim($path, '/');
|
50 |
$output = $this->request($url, array('overwrite' => ($overwrite)? 'true' : 'false'), 'PUT', $filehandle, $filesize);
|
51 |
fclose($filehandle);
|
52 |
+
} else {//chunk transfer on bigger uploads >50MB
|
53 |
$output = $this->chunked_upload($file, $path,$overwrite);
|
54 |
}
|
55 |
return $output;
|
64 |
$offset=0;
|
65 |
$ProgressFunction=null;
|
66 |
while ($data=fread($file_handle,4194304)) { //4194304 = 4MB
|
67 |
+
iwp_mmb_auto_print('dropbox_chucked_upload');
|
68 |
$chunkHandle = fopen('php://memory', 'rw');
|
69 |
fwrite($chunkHandle,$data);
|
70 |
rewind($chunkHandle);
|
216 |
$args = (is_array($args)) ? '?'.http_build_query($args, '', '&') : $args;
|
217 |
curl_setopt($ch, CURLOPT_URL, $url.$args);
|
218 |
}
|
219 |
+
|
220 |
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
221 |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
222 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
pclzip.class.php
CHANGED
@@ -2552,6 +2552,8 @@
|
|
2552 |
// --------------------------------------------------------------------------------
|
2553 |
function privAddFile($p_filedescr, &$p_header, &$p_options)
|
2554 |
{
|
|
|
|
|
2555 |
$v_result=1;
|
2556 |
|
2557 |
// ----- Working variable
|
@@ -3641,6 +3643,7 @@
|
|
3641 |
// --------------------------------------------------------------------------------
|
3642 |
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3643 |
{
|
|
|
3644 |
$v_result=1;
|
3645 |
|
3646 |
// ----- Read the file header
|
2552 |
// --------------------------------------------------------------------------------
|
2553 |
function privAddFile($p_filedescr, &$p_header, &$p_options)
|
2554 |
{
|
2555 |
+
iwp_mmb_auto_print('pcl_zipping');
|
2556 |
+
|
2557 |
$v_result=1;
|
2558 |
|
2559 |
// ----- Working variable
|
3643 |
// --------------------------------------------------------------------------------
|
3644 |
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3645 |
{
|
3646 |
+
iwp_mmb_auto_print('pcl_extracting');
|
3647 |
$v_result=1;
|
3648 |
|
3649 |
// ----- Read the file header
|
readme.txt
CHANGED
@@ -48,6 +48,10 @@ Credits: [Vladimir Prelovac](http://prelovac.com/vladimir) for his worker plugin
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
51 |
= 1.1.8 =
|
52 |
* Minor fixes
|
53 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.1.9 =
|
52 |
+
* Better error reporting
|
53 |
+
* Improved connection reliability
|
54 |
+
|
55 |
= 1.1.8 =
|
56 |
* Minor fixes
|
57 |
|
stats.class.php
CHANGED
@@ -66,7 +66,7 @@ class IWP_MMB_Stats extends IWP_MMB_Core
|
|
66 |
|
67 |
function get_comments($stats, $options = array())
|
68 |
{
|
69 |
-
$nposts =
|
70 |
$trimlen = isset($options['trimcontent']) ? (int) $options['trimcontent'] : 200;
|
71 |
|
72 |
// if ($nposts) {
|
@@ -513,7 +513,7 @@ class IWP_MMB_Stats extends IWP_MMB_Core
|
|
513 |
$use_cookie = 0;
|
514 |
if(@getenv('IS_WPE'))
|
515 |
$use_cookie=1;
|
516 |
-
|
517 |
$stats['email'] = get_option('admin_email');
|
518 |
$stats['no_openssl'] = $this->get_random_signature();
|
519 |
$stats['content_path'] = WP_CONTENT_DIR;
|
66 |
|
67 |
function get_comments($stats, $options = array())
|
68 |
{
|
69 |
+
$nposts = ($options['numberposts'] > 0) ? (int) $options['numberposts'] : 100;
|
70 |
$trimlen = isset($options['trimcontent']) ? (int) $options['trimcontent'] : 200;
|
71 |
|
72 |
// if ($nposts) {
|
513 |
$use_cookie = 0;
|
514 |
if(@getenv('IS_WPE'))
|
515 |
$use_cookie=1;
|
516 |
+
|
517 |
$stats['email'] = get_option('admin_email');
|
518 |
$stats['no_openssl'] = $this->get_random_signature();
|
519 |
$stats['content_path'] = WP_CONTENT_DIR;
|