Changeset 872784
- Timestamp:
- 03/10/2014 03:13:05 PM (12 years ago)
- Location:
- wpguards/trunk
- Files:
-
- 10 edited
-
modules/manager/addons/post_links/post.class.php (modified) (1 diff)
-
modules/manager/backup.class.php (modified) (11 diffs)
-
modules/manager/core.class.php (modified) (1 diff)
-
modules/manager/helper.class.php (modified) (1 diff)
-
modules/manager/init.php (modified) (10 diffs)
-
modules/manager/installer.class.php (modified) (4 diffs)
-
modules/manager/lib/dropbox.php (modified) (8 diffs)
-
modules/manager/pclzip.class.php (modified) (1 diff)
-
readme.txt (modified) (5 diffs)
-
wpguards.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpguards/trunk/modules/manager/addons/post_links/post.class.php
r872536 r872784 110 110 $attachments = array(); 111 111 $post_content = $post_data['post_content']; 112 113 foreach ($get_urls as $get_url_k => $get_url) { 114 // unset url in attachment array 115 foreach ($post_atta_img as $atta_url_k => $atta_url_v) { 116 $match_patt_url = '/' . str_replace($rep, $with, substr($atta_url_v['src'], 0, strrpos($atta_url_v['src'], '.'))) . '/'; 117 if (preg_match($match_patt_url, $get_url[4])) { 118 unset($post_atta_img[$atta_url_k]); 119 } 120 } 121 $pic_from_other_site = $get_urls[$get_url_k][4]; 122 /* if(strpos($pic_from_other_site,'exammple.com') === false){ 123 continue; 124 }*/ 125 126 if (isset($get_urls[$get_url_k][6])) { // url have parent, don't download this url 127 if ($get_url[1] != '') { 128 // change src url 129 $s_mmb_mp = '/' . str_replace($rep, $with, $get_url[4]) . '/'; 130 131 $s_img_atta = wp_get_attachment_image_src($get_urls[$get_url_k][6]); 132 $s_mmb_rp = $s_img_atta[0]; 133 $post_content = preg_replace($s_mmb_mp, $s_mmb_rp, $post_content); 134 // change attachment url 135 if (preg_match('/attachment_id/i', $get_url[2])) { 136 $iwp_mmb_mp = '/' . str_replace($rep, $with, $get_url[2]) . '/'; 137 $iwp_mmb_rp = get_bloginfo('wpurl') . '/?attachment_id=' . $get_urls[$get_url_k][6]; 138 $post_content = preg_replace($iwp_mmb_mp, $iwp_mmb_rp, $post_content); 139 } 140 } 141 continue; 142 } 143 144 $no_thumb = ''; 145 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $get_url[4])) { 146 $no_thumb = preg_replace('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', '.' . $get_url[5], $get_url[4]); 147 } else { 148 $no_thumb = $get_url[4]; 149 } 150 151 if(isset($upload['error']) && !empty($upload['error'])){ 152 return array('error' => $upload['error']); 153 } 154 $file_name = basename($no_thumb); 155 $tmp_file = download_url($no_thumb); 156 157 if(is_wp_error($tmp_file)){ 158 return array('error' => $tmp_file->get_error_message()); 159 } 160 161 $attach_upload['url'] = $upload['url'] . '/' . $file_name; 162 $attach_upload['path'] = $upload['path'] . '/' . $file_name; 163 $renamed = @rename($tmp_file, $attach_upload['path']); 164 if ($renamed === true) { 165 $match_pattern = '/' . str_replace($rep, $with, $get_url[4]) . '/'; 166 $replace_pattern = $attach_upload['url']; 167 $post_content = preg_replace($match_pattern, $replace_pattern, $post_content); 168 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $get_url[4])) { 169 $match_pattern = '/' . str_replace($rep, $with, preg_replace('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', '.' . $get_url[5], $get_url[4])) . '/'; 170 $post_content = preg_replace($match_pattern, $replace_pattern, $post_content); 171 } 172 173 $attachment = array( 174 'post_title' => $file_name, 175 'post_content' => '', 176 'post_type' => 'attachment', 177 //'post_parent' => $post_id, 178 'post_mime_type' => 'image/' . $get_url[5], 179 'guid' => $attach_upload['url'] 180 ); 181 182 // Save the data 183 184 $attach_id = wp_insert_attachment($attachment, $attach_upload['path']); 185 186 $attachments[$attach_id] = 0; 187 188 // featured image 189 if ($post_featured_img != '') { 190 $feat_img_url = ''; 191 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $post_featured_img)) { 192 $feat_img_url = substr($post_featured_img, 0, strrpos($post_featured_img, '.') - 8); 193 } else { 194 $feat_img_url = substr($post_featured_img, 0, strrpos($post_featured_img, '.')); 195 } 196 $m_feat_url = '/' . str_replace($rep, $with, $feat_img_url) . '/'; 197 if (preg_match($m_feat_url, $get_url[4])) { 198 $post_featured_img = ''; 199 $attachments[$attach_id] = $attach_id; 200 } 201 } 202 203 // set $get_urls value[6] - parent atta_id 204 foreach ($get_urls as $url_k => $url_v) { 205 if ($get_url_k != $url_k) { 206 $s_get_url = ''; 207 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $url_v[4])) { 208 $s_get_url = substr($url_v[4], 0, strrpos($url_v[4], '.') - 8); 209 } else { 210 $s_get_url = substr($url_v[4], 0, strrpos($url_v[4], '.')); 211 } 212 $m_patt_url = '/' . str_replace($rep, $with, $s_get_url) . '/'; 213 if (preg_match($m_patt_url, $get_url[4])) { 214 array_push($get_urls[$url_k], $attach_id); 215 } 216 } 217 } 218 219 220 $some_data = wp_generate_attachment_metadata($attach_id, $attach_upload['path']); 221 wp_update_attachment_metadata($attach_id, $some_data); 222 223 224 //changing href of a tag 225 if ($get_url[1] != '') { 226 $iwp_mmb_mp = '/' . str_replace($rep, $with, $get_url[2]) . '/'; 227 if (preg_match('/attachment_id/i', $get_url[2])) { 228 $iwp_mmb_rp = get_bloginfo('wpurl') . '/?attachment_id=' . $attach_id; 229 $post_content = preg_replace($iwp_mmb_mp, $iwp_mmb_rp, $post_content); 230 } 231 } 232 } else { 233 @unlink($tmp_file); 234 return array('error' => "Cannot create attachment file in ".$attach_upload['path']." Please set correct permissions."); 235 236 } 237 @unlink($tmp_file); 238 } 112 113 if(!empty($get_urls) && is_array($get_urls)){ 114 foreach ($get_urls as $get_url_k => $get_url) { 115 // unset url in attachment array 116 if(!empty($post_atta_img) && is_array($post_atta_img)){ 117 foreach ($post_atta_img as $atta_url_k => $atta_url_v) { 118 $match_patt_url = '/' . str_replace($rep, $with, substr($atta_url_v['src'], 0, strrpos($atta_url_v['src'], '.'))) . '/'; 119 if (preg_match($match_patt_url, $get_url[4])) { 120 unset($post_atta_img[$atta_url_k]); 121 } 122 } 123 } 124 $pic_from_other_site = $get_urls[$get_url_k][4]; 125 /* if(strpos($pic_from_other_site,'exammple.com') === false){ 126 continue; 127 }*/ 128 129 if (isset($get_urls[$get_url_k][6])) { // url have parent, don't download this url 130 if ($get_url[1] != '') { 131 // change src url 132 $s_mmb_mp = '/' . str_replace($rep, $with, $get_url[4]) . '/'; 133 134 $s_img_atta = wp_get_attachment_image_src($get_urls[$get_url_k][6]); 135 $s_mmb_rp = $s_img_atta[0]; 136 $post_content = preg_replace($s_mmb_mp, $s_mmb_rp, $post_content); 137 // change attachment url 138 if (preg_match('/attachment_id/i', $get_url[2])) { 139 $iwp_mmb_mp = '/' . str_replace($rep, $with, $get_url[2]) . '/'; 140 $iwp_mmb_rp = get_bloginfo('wpurl') . '/?attachment_id=' . $get_urls[$get_url_k][6]; 141 $post_content = preg_replace($iwp_mmb_mp, $iwp_mmb_rp, $post_content); 142 } 143 } 144 continue; 145 } 146 147 $no_thumb = ''; 148 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $get_url[4])) { 149 $no_thumb = preg_replace('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', '.' . $get_url[5], $get_url[4]); 150 } else { 151 $no_thumb = $get_url[4]; 152 } 153 154 if(isset($upload['error']) && !empty($upload['error'])){ 155 return array('error' => $upload['error']); 156 } 157 $file_name = basename($no_thumb); 158 $tmp_file = download_url($no_thumb); 159 160 if(is_wp_error($tmp_file)){ 161 return array('error' => $tmp_file->get_error_message()); 162 } 163 164 $attach_upload['url'] = $upload['url'] . '/' . $file_name; 165 $attach_upload['path'] = $upload['path'] . '/' . $file_name; 166 $renamed = @rename($tmp_file, $attach_upload['path']); 167 if ($renamed === true) { 168 $match_pattern = '/' . str_replace($rep, $with, $get_url[4]) . '/'; 169 $replace_pattern = $attach_upload['url']; 170 $post_content = preg_replace($match_pattern, $replace_pattern, $post_content); 171 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $get_url[4])) { 172 $match_pattern = '/' . str_replace($rep, $with, preg_replace('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', '.' . $get_url[5], $get_url[4])) . '/'; 173 $post_content = preg_replace($match_pattern, $replace_pattern, $post_content); 174 } 175 176 $attachment = array( 177 'post_title' => $file_name, 178 'post_content' => '', 179 'post_type' => 'attachment', 180 //'post_parent' => $post_id, 181 'post_mime_type' => 'image/' . $get_url[5], 182 'guid' => $attach_upload['url'] 183 ); 184 185 // Save the data 186 187 $attach_id = wp_insert_attachment($attachment, $attach_upload['path']); 188 189 $attachments[$attach_id] = 0; 190 191 // featured image 192 if ($post_featured_img != '') { 193 $feat_img_url = ''; 194 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $post_featured_img)) { 195 $feat_img_url = substr($post_featured_img, 0, strrpos($post_featured_img, '.') - 8); 196 } else { 197 $feat_img_url = substr($post_featured_img, 0, strrpos($post_featured_img, '.')); 198 } 199 $m_feat_url = '/' . str_replace($rep, $with, $feat_img_url) . '/'; 200 if (preg_match($m_feat_url, $get_url[4])) { 201 $post_featured_img = ''; 202 $attachments[$attach_id] = $attach_id; 203 } 204 } 205 206 // set $get_urls value[6] - parent atta_id 207 foreach ($get_urls as $url_k => $url_v) { 208 if ($get_url_k != $url_k) { 209 $s_get_url = ''; 210 if (preg_match('/-\d{3}x\d{3}\.[a-zA-Z0-9]{3,4}$/', $url_v[4])) { 211 $s_get_url = substr($url_v[4], 0, strrpos($url_v[4], '.') - 8); 212 } else { 213 $s_get_url = substr($url_v[4], 0, strrpos($url_v[4], '.')); 214 } 215 $m_patt_url = '/' . str_replace($rep, $with, $s_get_url) . '/'; 216 if (preg_match($m_patt_url, $get_url[4])) { 217 array_push($get_urls[$url_k], $attach_id); 218 } 219 } 220 } 221 222 223 $some_data = wp_generate_attachment_metadata($attach_id, $attach_upload['path']); 224 wp_update_attachment_metadata($attach_id, $some_data); 225 226 227 //changing href of a tag 228 if ($get_url[1] != '') { 229 $iwp_mmb_mp = '/' . str_replace($rep, $with, $get_url[2]) . '/'; 230 if (preg_match('/attachment_id/i', $get_url[2])) { 231 $iwp_mmb_rp = get_bloginfo('wpurl') . '/?attachment_id=' . $attach_id; 232 $post_content = preg_replace($iwp_mmb_mp, $iwp_mmb_rp, $post_content); 233 } 234 } 235 } else { 236 @unlink($tmp_file); 237 return array('error' => "Cannot create attachment file in ".$attach_upload['path']." Please set correct permissions."); 238 239 } 240 @unlink($tmp_file); 241 } 242 } 239 243 240 244 -
wpguards/trunk/modules/manager/backup.class.php
r872536 r872784 110 110 //WPguards modify!!!!!! 111 111 if ( (int) @ini_get('max_execution_time') < 7200 ) { 112 @ini_set('max_execution_time', 7200);//two hours113 @set_time_limit(7200);114 $changed['execution_time'] = 1;115 }112 @ini_set('max_execution_time', 7200);//two hours 113 @set_time_limit(7200); 114 $changed['execution_time'] = 1; 115 } 116 116 117 117 return $changed; … … 178 178 $before[$task_name]['task_results'] = array_values($before[$task_name]['task_results']); 179 179 } 180 $before[$task_name]['task_results'][count($before[$task_name]['task_results'])]['time'] = (isset($time) && $time) ? $time : time();180 //$before[$task_name]['task_results'][count($before[$task_name]['task_results'])]['time'] = (isset($time) && $time) ? $time : time(); 181 181 //} 182 182 if (isset($time) && $time) { //This will occur for schedule runtask. 183 $before[$task_name]['task_results'][count($before[$task_name]['task_results'])]['time'] = $time; 184 }else{ 185 if($task_name == 'Backup Now') 186 $before[$task_name]['task_results'][count($before[$task_name]['task_results'])]['time'] = time(); 187 } 183 188 184 189 $this->update_tasks($before); … … 321 326 if (!$args || empty($args)) 322 327 return false; 323 328 324 329 extract($args); //extract settings 325 330 … … 557 562 558 563 $this->update_status($task_name,'finished',true); 559 do_action( 'iwp_after_backup', $backup_url, $backup_settings[$task_name], $paths, $task_name ); 560 564 561 565 return $backup_url; //Return url to backup file 562 566 } … … 1294 1298 function restore($args) 1295 1299 { 1296 $args = apply_filters('before_backup', $args, $this->tasks );1297 1300 1298 1301 global $wpdb, $wp_filesystem; 1299 1302 if (empty($args)) { 1300 return false; 1301 } 1303 return false; 1304 } 1302 1305 1303 1306 extract($args); 1304 1307 $this->set_memory(); 1305 1308 1306 $unlink_file = false; //Delete file after restore1309 $unlink_file = true; //Delete file after restore 1307 1310 1308 1311 include_once ABSPATH . 'wp-admin/includes/file.php'; … … 1324 1327 if (isset($task['task_results'][$result_id]['server'])) { 1325 1328 $backup_file = $task['task_results'][$result_id]['server']['file_path']; 1326 $unlink_file = true; //Don't delete file if stored on server1329 $unlink_file = false; //Don't delete file if stored on server 1327 1330 1328 1331 } elseif (isset($task['task_results'][$result_id]['ftp'])) { … … 1495 1498 iwp_mmb_print_flush('ZIP Extract PCL: Start'); 1496 1499 $archive = new IWPPclZip($backup_file); 1497 $result = $archive->extract(PCLZIP_OPT_PATH, $new_temp_folder, PCLZIP_OPT_ REPLACE_NEWER);1500 $result = $archive->extract(PCLZIP_OPT_PATH, $new_temp_folder, PCLZIP_OPT_TEMP_FILE_THRESHOLD, 1); 1498 1501 iwp_mmb_print_flush('ZIP Extract PCL: End'); 1499 1502 } … … 1501 1504 1502 1505 if ($unlink_file) { 1503 //@unlink($backup_file);1506 @unlink($backup_file); 1504 1507 } 1505 1508 … … 2099 2102 require_once $GLOBALS['iwp_mmb_plugin_dir'] . '/lib/dropbox.php'; 2100 2103 2101 $dropbox = new Dropbox($consumer_key, $consumer_secret); 2104 2105 $dropbox = new IWP_Dropbox($consumer_key, $consumer_secret); 2106 2102 2107 $dropbox->setOAuthTokens($oauth_token, $oauth_token_secret); 2103 2108 … … 2133 2138 require_once $GLOBALS['iwp_mmb_plugin_dir'] . '/lib/dropbox.php'; 2134 2139 2135 $dropbox = new Dropbox($consumer_key, $consumer_secret); 2140 2141 $dropbox = new IWP_Dropbox($consumer_key, $consumer_secret); 2142 2143 2136 2144 $dropbox->setOAuthTokens($oauth_token, $oauth_token_secret); 2137 2145 … … 2158 2166 require_once $GLOBALS['iwp_mmb_plugin_dir'] . '/lib/dropbox.php'; 2159 2167 2160 $dropbox = new Dropbox($consumer_key, $consumer_secret); 2168 2169 $dropbox = new IWP_Dropbox($consumer_key, $consumer_secret); 2170 2171 2161 2172 $dropbox->setOAuthTokens($oauth_token, $oauth_token_secret); 2162 2173 -
wpguards/trunk/modules/manager/core.class.php
r872536 r872784 1 1 <?php 2 3 2 /************************************************************ 4 5 3 * This plugin was modified by Revmakx * 6 7 4 * Copyright (c) 2012 Revmakx * 8 9 5 * www.revmakx.com * 10 11 6 * * 12 13 7 ************************************************************/ 14 15 8 /************************************************************* 16 17 9 * 18 19 10 * core.class.php 20 21 11 * 22 23 12 * Upgrade Plugins 24 25 13 * 26 27 14 * 28 29 15 * Copyright (c) 2011 Prelovac Media 30 31 16 * www.prelovac.com 32 33 17 **************************************************************/ 34 35 18 36 37 19 class IWP_MMB_Core extends IWP_MMB_Helper 38 39 20 { 40 41 21 var $name; 42 43 22 var $slug; 44 45 23 var $settings; 46 47 24 var $remote_client; 48 49 25 var $comment_instance; 50 51 26 var $plugin_instance; 52 53 27 var $theme_instance; 54 55 28 var $wp_instance; 56 57 29 var $post_instance; 58 59 30 var $stats_instance; 60 61 31 var $search_instance; 62 63 32 var $links_instance; 64 65 33 var $user_instance; 66 67 34 var $backup_instance; 68 69 35 var $installer_instance; 70 71 36 var $iwp_mmb_multisite; 72 73 37 var $network_admin_install; 74 75 38 76 77 39 var $backup_repository_instance; 78 79 40 var $optimize_instance; 80 81 41 82 83 42 private $action_call; 84 85 43 private $action_params; 86 87 44 private $iwp_mmb_pre_init_actions; 88 89 45 private $iwp_mmb_pre_init_filters; 90 91 46 private $iwp_mmb_init_actions; 92 93 94 95 96 47 48 97 49 function __construct() 98 99 { 100 50 { 101 51 global $iwp_mmb_plugin_dir, $wpmu_version, $blog_id, $_iwp_mmb_plugin_actions, $_iwp_mmb_item_filter; 102 103 104 52 105 53 $_iwp_mmb_plugin_actions = array(); 106 107 54 $this->name = 'Manage Multiple Blogs'; 108 109 55 $this->slug = 'manage-multiple-blogs'; 110 111 56 $this->action_call = null; 112 113 57 $this->action_params = null; 114 115 116 117 118 58 59 119 60 $this->settings = get_option($this->slug); 120 121 61 if (!$this->settings) { 122 123 62 $this->settings = array( 124 125 63 'blogs' => array(), 126 127 64 'current_blog' => array( 128 129 65 'type' => null 130 131 66 ) 132 133 67 ); 134 135 68 $this->save_options(); 136 137 } 138 69 } 139 70 if ( function_exists('is_multisite') ) { 140 141 71 if ( is_multisite() ) { 142 143 72 $this->iwp_mmb_multisite = $blog_id; 144 145 73 $this->network_admin_install = get_option('iwp_client_network_admin_install'); 146 147 74 } 148 149 75 } else if (!empty($wpmu_version)) { 150 151 76 $this->iwp_mmb_multisite = $blog_id; 152 153 77 $this->network_admin_install = get_option('iwp_client_network_admin_install'); 154 155 78 } else { 156 157 79 $this->iwp_mmb_multisite = false; 158 159 80 $this->network_admin_install = null; 160 161 81 } 162 163 164 82 165 83 // admin notices 166 167 84 if ( !get_option('iwp_client_public_key') ){ 168 169 85 if( $this->iwp_mmb_multisite ){ 170 171 86 if( is_network_admin() && $this->network_admin_install == '1'){ 172 173 87 add_action('network_admin_notices', array( &$this, 'network_admin_notice' )); 174 175 88 } else if( $this->network_admin_install != '1' ){ 176 177 89 //$parent_key = $this->get_parent_blog_option('iwp_client_public_key');//IWP commented to show notice to all subsites of network 178 179 90 //if(empty($parent_key))//IWP commented to show notice to all subsites of network 180 181 91 add_action('admin_notices', array( &$this, 'admin_notice' )); 182 183 92 } 184 185 93 } else { 186 187 94 add_action('admin_notices', array( &$this, 'admin_notice' )); 188 189 95 } 190 191 96 } 192 193 194 97 195 98 // default filters 196 197 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 198 199 100 $this->iwp_mmb_pre_init_filters['get_stats']['iwp_mmb_stats_filter'][] = 'iwp_mmb_pre_init_stats'; 200 201 202 101 203 102 $_iwp_mmb_item_filter['pre_init_stats'] = array( 'core_update', 'hit_counter', 'comments', 'backups', 'posts', 'drafts', 'scheduled' ); 204 205 103 $_iwp_mmb_item_filter['get'] = array( 'updates', 'errors' ); 206 207 208 104 209 105 $this->iwp_mmb_pre_init_actions = array( 210 211 106 'backup_req' => 'iwp_mmb_get_backup_req', 212 213 107 ); 214 215 216 108 217 109 $this->iwp_mmb_init_actions = array( 218 219 110 'do_upgrade' => 'iwp_mmb_do_upgrade', 220 221 111 'get_stats' => 'iwp_mmb_stats_get', 222 223 112 'remove_site' => 'iwp_mmb_remove_site', 224 225 113 'backup_clone' => 'iwp_mmb_backup_now', 226 227 114 'restore' => 'iwp_mmb_restore_now', 228 229 115 'optimize_tables' => 'iwp_mmb_optimize_tables', 230 231 116 'check_wp_version' => 'iwp_mmb_wp_checkversion', 232 233 117 'create_post' => 'iwp_mmb_post_create', 234 235 118 'update_client' => 'iwp_mmb_update_client_plugin', 236 237 238 119 239 120 'change_comment_status' => 'iwp_mmb_change_comment_status', 240 241 121 'change_post_status' => 'iwp_mmb_change_post_status', 242 243 122 'get_comment_stats' => 'iwp_mmb_comment_stats_get', 244 245 246 123 247 124 'get_links' => 'iwp_mmb_get_links', 248 249 125 'add_link' => 'iwp_mmb_add_link', 250 251 126 'delete_link' => 'iwp_mmb_delete_link', 252 253 127 'delete_links' => 'iwp_mmb_delete_links', 254 255 256 128 257 129 'create_post' => 'iwp_mmb_post_create', 258 259 130 'change_post_status' => 'iwp_mmb_change_post_status', 260 261 131 'get_posts' => 'iwp_mmb_get_posts', 262 263 132 'delete_post' => 'iwp_mmb_delete_post', 264 265 133 'delete_posts' => 'iwp_mmb_delete_posts', 266 267 134 'edit_posts' => 'iwp_mmb_edit_posts', 268 269 135 'get_pages' => 'iwp_mmb_get_pages', 270 271 136 'delete_page' => 'iwp_mmb_delete_page', 272 273 274 137 275 138 'install_addon' => 'iwp_mmb_install_addon', 276 277 139 'add_link' => 'iwp_mmb_add_link', 278 279 140 'add_user' => 'iwp_mmb_add_user', 280 281 141 'email_backup' => 'iwp_mmb_email_backup', 282 283 142 'check_backup_compat' => 'iwp_mmb_check_backup_compat', 284 285 143 'scheduled_backup' => 'iwp_mmb_scheduled_backup', 286 287 144 'run_task' => 'iwp_mmb_run_task_now', 288 289 145 'delete_schedule_task' => 'iwp_mmb_delete_task_now', 290 291 146 'execute_php_code' => 'iwp_mmb_execute_php_code', 292 293 147 'delete_backup' => 'iwp_mmb_delete_backup', 294 295 148 'remote_backup_now' => 'iwp_mmb_remote_backup_now', 296 297 149 'set_notifications' => 'iwp_mmb_set_notifications', 298 299 150 'clean_orphan_backups' => 'iwp_mmb_clean_orphan_backups', 300 301 151 'get_users' => 'iwp_mmb_get_users', 302 303 152 'edit_users' => 'iwp_mmb_edit_users', 304 305 153 'get_plugins_themes' => 'iwp_mmb_get_plugins_themes', 306 307 154 'edit_plugins_themes' => 'iwp_mmb_edit_plugins_themes', 308 309 155 'get_comments' => 'iwp_mmb_get_comments', 310 311 156 'action_comment' => 'iwp_mmb_action_comment', 312 313 157 'bulk_action_comments' => 'iwp_mmb_bulk_action_comments', 314 315 158 'replyto_comment' => 'iwp_mmb_reply_comment', 316 317 159 'client_brand' => 'iwp_mmb_client_brand', 318 319 160 'set_alerts' => 'iwp_mmb_set_alerts', 320 321 161 'maintenance' => 'iwp_mmb_maintenance_mode', 322 323 324 162 325 163 'wp_optimize' => 'iwp_mmb_wp_optimize', 326 327 328 164 329 165 'backup_repository' => 'iwp_mmb_backup_repository' 330 331 166 ); 332 333 334 167 335 168 add_action('rightnow_end', array( &$this, 'add_right_now_info' )); 336 337 169 add_action('admin_init', array(&$this,'admin_actions')); 338 339 170 add_action('init', array( &$this, 'iwp_mmb_remote_action'), 9999); 340 341 171 add_action('setup_theme', 'iwp_mmb_parse_request'); 342 343 172 add_action('set_auth_cookie', array( &$this, 'iwp_mmb_set_auth_cookie')); 344 345 173 add_action('set_logged_in_cookie', array( &$this, 'iwp_mmb_set_logged_in_cookie')); 346 347 348 349 } 350 351 352 174 175 } 176 353 177 function iwp_mmb_remote_action(){ 354 355 178 if($this->action_call != null){ 356 357 179 $params = isset($this->action_params) && $this->action_params != null ? $this->action_params : array(); 358 359 180 call_user_func($this->action_call, $params); 360 361 181 } 362 363 182 } 364 365 183 366 367 184 function register_action_params( $action = false, $params = array() ){ 368 369 370 185 371 186 if(isset($this->iwp_mmb_pre_init_actions[$action]) && function_exists($this->iwp_mmb_pre_init_actions[$action])){ 372 373 187 call_user_func($this->iwp_mmb_pre_init_actions[$action], $params); 374 375 188 } 376 377 378 189 379 190 if(isset($this->iwp_mmb_init_actions[$action]) && function_exists($this->iwp_mmb_init_actions[$action])){ 380 381 191 $this->action_call = $this->iwp_mmb_init_actions[$action]; 382 383 192 $this->action_params = $params; 384 385 386 193 387 194 if( isset($this->iwp_mmb_pre_init_filters[$action]) && !empty($this->iwp_mmb_pre_init_filters[$action])){ 388 389 195 global $iwp_mmb_filters; 390 391 196 392 393 197 foreach($this->iwp_mmb_pre_init_filters[$action] as $_name => $_functions){ 394 395 198 if(!empty($_functions)){ 396 397 199 $data = array(); 398 399 200 400 401 201 foreach($_functions as $_k => $_callback){ 402 403 202 if(is_array($_callback) && method_exists($_callback[0], $_callback[1]) ){ 404 405 203 $data = call_user_func( $_callback, $params ); 406 407 204 } elseif (is_string($_callback) && function_exists( $_callback )){ 408 409 205 $data = call_user_func( $_callback, $params ); 410 411 206 } 412 413 207 $iwp_mmb_filters[$_name] = isset($iwp_mmb_filters[$_name]) && !empty($iwp_mmb_filters[$_name]) ? array_merge($iwp_mmb_filters[$_name], $data) : $data; 414 415 208 add_filter( $_name, create_function( '$a' , 'global $iwp_mmb_filters; return array_merge($a, $iwp_mmb_filters["'.$_name.'"]);') ); 416 417 209 } 418 419 210 } 420 421 211 422 423 212 } 424 425 213 } 426 427 214 return true; 428 429 215 } 430 431 216 return false; 432 433 217 } 434 435 218 436 437 /** 438 219 /** 439 220 * Add notice to network admin dashboard for security reasons 440 441 * 442 443 */ 444 221 * 222 */ 445 223 function network_admin_notice() 446 447 { 448 224 { 449 225 echo '<div class="error" style="text-align: center;"><p style="font-size: 14px; font-weight: bold; color:#c00;">Attention !</p> 450 451 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>'; 452 453 } 454 227 } 455 228 456 457 458 229 459 230 /** 460 461 231 * Add notice to admin dashboard for security reasons 462 463 * 464 465 */ 466 232 * 233 */ 467 234 function admin_notice() 468 469 { 470 235 { 471 236 /* IWP */ 472 /* We don't need that notices anymore */ 473 474 /*if(defined('MULTISITE') && MULTISITE == true){ 475 237 if(defined('MULTISITE') && MULTISITE == true){ 476 238 global $blog_id; 477 478 239 $user_id_from_email = get_user_id_from_string( get_blog_option($blog_id, 'admin_email')); 479 480 240 $details = get_userdata($user_id_from_email); 481 482 241 $username = $details->user_login; 483 484 242 } 485 486 243 else{ 487 488 244 $current_user = wp_get_current_user(); 489 490 245 $username = $current_user->data->user_login; 491 492 246 } 493 494 495 247 496 248 $iwp_client_activate_key = get_option('iwp_client_activate_key'); 497 498 499 249 500 250 //check BWP 501 502 251 $bwp = get_option("bit51_bwps"); 503 504 252 $notice_display_URL=admin_url(); 505 506 253 if(!empty($bwp)) 507 508 254 { 509 510 255 //$bwpArray = @unserialize($bwp); 511 512 256 if($bwp['hb_enabled']==1) 513 514 257 $notice_display_URL = get_option('home'); 515 516 258 } 517 518 519 259 520 260 $notice_display_URL = rtrim($notice_display_URL, '/').'/'; 521 522 523 524 525 261 262 526 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> 527 528 264 <table border="0" align="center">'; 529 530 265 if(!empty($iwp_client_activate_key)){ 531 532 266 echo '<tr><td align="right">WP-ADMIN URL:</td><td align="left"><strong>'.$notice_display_URL.'</strong></td></tr> 533 534 267 <tr><td align="right">ADMIN USERNAME:</td><td align="left"><strong>'.$username.'</strong> (or any admin id)</td></tr> 535 536 268 <tr><td align="right">ACTIVATION KEY:</td><td align="left"><strong>'.$iwp_client_activate_key.'</strong></td></tr>'; 537 538 269 } 539 540 270 else{ 541 542 271 echo '<tr><td align="center">Please deactivate and then activate InfiniteWP Client plugin.</td></tr>'; 543 544 272 } 545 546 547 273 548 274 echo '</table> 549 550 </p></div>'; */ 551 552 553 554 } 555 556 557 558 /** 559 275 </p></div>'; 276 277 } 278 279 /** 560 280 * Add an item into the Right Now Dashboard widget 561 562 281 * to inform that the blog can be managed remotely 563 564 * 565 566 */ 567 282 * 283 */ 568 284 function add_right_now_info() 569 570 { 571 285 { 572 286 echo '<div class="iwp_mmb-slave-info"> 573 574 287 <p>This site can be managed remotely.</p> 575 576 288 </div>'; 577 578 } 579 580 581 582 /** 583 289 } 290 291 /** 584 292 * Get parent blog options 585 586 * 587 588 */ 589 293 * 294 */ 590 295 private function get_parent_blog_option( $option_name = '' ) 591 592 { 593 296 { 594 297 global $wpdb; 595 596 298 $option = $wpdb->get_var( $wpdb->prepare( "SELECT `option_value` FROM {$wpdb->base_prefix}options WHERE option_name = %s LIMIT 1", $option_name ) ); 597 598 299 return $option; 599 600 } 601 602 603 300 } 301 604 302 605 606 303 /** 607 608 304 * Gets an instance of the WP_Optimize class 609 610 * 611 612 */ 613 305 * 306 */ 614 307 function wp_optimize_instance() 615 616 { 617 308 { 618 309 if (!isset($this->optimize_instance)) { 619 620 310 $this->optimize_instance = new IWP_MMB_Optimize(); 621 622 } 623 624 625 311 } 312 626 313 return $this->optimize_instance; 627 628 } 629 630 631 632 /** 633 314 } 315 316 /** 634 317 * Gets an instance of the Comment class 635 636 * 637 638 */ 639 318 * 319 */ 640 320 function get_comment_instance() 641 642 { 643 321 { 644 322 if (!isset($this->comment_instance)) { 645 646 323 $this->comment_instance = new IWP_MMB_Comment(); 647 648 } 649 650 651 324 } 325 652 326 return $this->comment_instance; 653 654 } 655 656 657 658 /** 659 327 } 328 329 /** 660 330 * Gets an instance of the Plugin class 661 662 * 663 664 */ 665 331 * 332 */ 666 333 function get_plugin_instance() 667 668 { 669 334 { 670 335 if (!isset($this->plugin_instance)) { 671 672 336 $this->plugin_instance = new IWP_MMB_Plugin(); 673 674 } 675 676 677 337 } 338 678 339 return $this->plugin_instance; 679 680 } 681 682 683 684 /** 685 340 } 341 342 /** 686 343 * Gets an instance of the Theme class 687 688 * 689 690 */ 691 344 * 345 */ 692 346 function get_theme_instance() 693 694 { 695 347 { 696 348 if (!isset($this->theme_instance)) { 697 698 349 $this->theme_instance = new IWP_MMB_Theme(); 699 700 } 701 702 703 350 } 351 704 352 return $this->theme_instance; 705 706 } 707 708 709 710 711 712 /** 713 353 } 354 355 356 /** 714 357 * Gets an instance of IWP_MMB_Post class 715 716 * 717 718 */ 719 358 * 359 */ 720 360 function get_post_instance() 721 722 { 723 361 { 724 362 if (!isset($this->post_instance)) { 725 726 363 $this->post_instance = new IWP_MMB_Post(); 727 728 } 729 730 731 364 } 365 732 366 return $this->post_instance; 733 734 } 735 736 737 738 /** 739 367 } 368 369 /** 740 370 * Gets an instance of Blogroll class 741 742 * 743 744 */ 745 371 * 372 */ 746 373 function get_blogroll_instance() 747 748 { 749 374 { 750 375 if (!isset($this->blogroll_instance)) { 751 752 376 $this->blogroll_instance = new IWP_MMB_Blogroll(); 753 754 } 755 756 757 377 } 378 758 379 return $this->blogroll_instance; 759 760 } 761 762 763 764 765 766 767 768 /** 769 380 } 381 382 383 384 /** 770 385 * Gets an instance of the WP class 771 772 * 773 774 */ 775 386 * 387 */ 776 388 function get_wp_instance() 777 778 { 779 389 { 780 390 if (!isset($this->wp_instance)) { 781 782 391 $this->wp_instance = new IWP_MMB_WP(); 783 784 } 785 786 787 392 } 393 788 394 return $this->wp_instance; 789 790 } 791 792 793 794 /** 795 395 } 396 397 /** 796 398 * Gets an instance of User 797 798 * 799 800 */ 801 399 * 400 */ 802 401 function get_user_instance() 803 804 { 805 402 { 806 403 if (!isset($this->user_instance)) { 807 808 404 $this->user_instance = new IWP_MMB_User(); 809 810 } 811 812 813 405 } 406 814 407 return $this->user_instance; 815 816 } 817 818 819 820 /** 821 408 } 409 410 /** 822 411 * Gets an instance of stats class 823 824 * 825 826 */ 827 412 * 413 */ 828 414 function get_stats_instance() 829 830 { 831 415 { 832 416 if (!isset($this->stats_instance)) { 833 834 417 $this->stats_instance = new IWP_MMB_Stats(); 835 836 } 837 418 } 838 419 return $this->stats_instance; 839 840 } 841 842 /** 843 420 } 421 /** 844 422 * Gets an instance of search class 845 846 * 847 848 */ 849 423 * 424 */ 850 425 function get_search_instance() 851 852 { 853 426 { 854 427 if (!isset($this->search_instance)) { 855 856 428 $this->search_instance = new IWP_MMB_Search(); 857 858 } 859 429 } 860 430 //return $this->search_instance; 861 862 431 return $this->search_instance; 863 864 } 865 866 /** 867 432 } 433 /** 868 434 * Gets an instance of stats class 869 870 435 * 871 872 */ 873 436 */ 874 437 function get_backup_instance() 875 876 { 877 438 { 878 439 if (!isset($this->backup_instance)) { 879 880 440 $this->backup_instance = new IWP_MMB_Backup(); 881 882 } 883 884 885 441 } 442 886 443 return $this->backup_instance; 887 888 } 889 890 891 444 } 445 892 446 function get_backup_repository_instance() 893 894 { 895 447 { 896 448 if (!isset($this->backup_repository_instance)) { 897 898 449 $this->backup_repository_instance = new IWP_MMB_Backup_Repository(); 899 900 } 901 902 903 450 } 451 904 452 return $this->backup_repository_instance; 905 906 } 907 908 909 910 /** 911 453 } 454 455 /** 912 456 * Gets an instance of links class 913 914 457 * 915 916 */ 917 458 */ 918 459 function get_link_instance() 919 920 { 921 460 { 922 461 if (!isset($this->link_instance)) { 923 924 462 $this->link_instance = new IWP_MMB_Link(); 925 926 } 927 928 929 463 } 464 930 465 return $this->link_instance; 931 932 } 933 934 935 466 } 467 936 468 function get_installer_instance() 937 938 { 939 469 { 940 470 if (!isset($this->installer_instance)) { 941 942 471 $this->installer_instance = new IWP_MMB_Installer(); 943 944 } 945 472 } 946 473 return $this->installer_instance; 947 948 } 949 474 } 950 475 951 952 /** 953 476 /** 954 477 * Plugin install callback function 955 956 478 * Check PHP version 957 958 */ 959 479 */ 960 480 function install() { 961 962 963 481 964 482 global $wpdb, $_wp_using_ext_object_cache, $current_user; 965 966 483 $_wp_using_ext_object_cache = false; 967 484 968 969 970 485 //delete plugin options, just in case 971 972 486 if ($this->iwp_mmb_multisite != false) { 973 974 487 $network_blogs = $wpdb->get_results("select `blog_id`, `site_id` from `{$wpdb->blogs}`"); 975 976 488 if(!empty($network_blogs)){ 977 978 489 if( is_network_admin() ){ 979 980 490 update_option('iwp_client_network_admin_install', 1); 981 982 491 foreach($network_blogs as $details){ 983 984 492 if($details->site_id == $details->blog_id) 985 986 493 update_blog_option($details->blog_id, 'iwp_client_network_admin_install', 1); 987 988 494 else 989 990 495 update_blog_option($details->blog_id, 'iwp_client_network_admin_install', -1); 991 992 496 993 994 497 delete_blog_option($blog_id, 'iwp_client_nossl_key'); 995 996 498 delete_blog_option($blog_id, 'iwp_client_public_key'); 997 998 499 delete_blog_option($blog_id, 'iwp_client_action_message_id'); 999 1000 500 } 1001 1002 501 } else { 1003 1004 502 update_option('iwp_client_network_admin_install', -1); 1005 1006 503 delete_option('iwp_client_nossl_key'); 1007 1008 504 delete_option('iwp_client_public_key'); 1009 1010 505 delete_option('iwp_client_action_message_id'); 1011 1012 506 } 1013 1014 507 } 1015 1016 508 } else { 1017 1018 509 delete_option('iwp_client_nossl_key'); 1019 1020 510 delete_option('iwp_client_public_key'); 1021 1022 511 delete_option('iwp_client_action_message_id'); 1023 1024 } 1025 1026 1027 512 } 513 1028 514 //delete_option('iwp_client_backup_tasks'); 1029 1030 515 delete_option('iwp_client_notifications'); 1031 1032 516 delete_option('iwp_client_brand'); 1033 1034 517 delete_option('iwp_client_pageview_alerts'); 1035 518 1036 1037 1038 519 add_option('iwp_client_activate_key', sha1( rand(1, 99999). uniqid('', true) . get_option('siteurl') ) ); 1039 1040 1041 1042 } 1043 1044 1045 1046 /** 1047 520 521 } 522 523 /** 1048 524 * Saves the (modified) options into the database 1049 1050 * 1051 1052 */ 1053 525 * 526 */ 1054 527 function save_options() 1055 1056 { 1057 528 { 1058 529 if (get_option($this->slug)) { 1059 1060 530 update_option($this->slug, $this->settings); 1061 1062 531 } else { 1063 1064 532 add_option($this->slug, $this->settings); 1065 1066 } 1067 1068 } 1069 1070 1071 1072 /** 1073 533 } 534 } 535 536 /** 1074 537 * Deletes options for communication with IWP Admin panel 1075 1076 * 1077 1078 */ 1079 538 * 539 */ 1080 540 function uninstall( $deactivate = false ) 1081 1082 { 1083 541 { 1084 542 global $current_user, $wpdb, $_wp_using_ext_object_cache; 1085 1086 543 $_wp_using_ext_object_cache = false; 1087 1088 1089 544 1090 545 if ($this->iwp_mmb_multisite != false) { 1091 1092 546 $network_blogs = $wpdb->get_col("select `blog_id` from `{$wpdb->blogs}`"); 1093 1094 547 if(!empty($network_blogs)){ 1095 1096 548 if( is_network_admin() ){ 1097 1098 549 if( $deactivate ) { 1099 1100 550 delete_option('iwp_client_network_admin_install'); 1101 1102 551 foreach($network_blogs as $blog_id){ 1103 1104 552 delete_blog_option($blog_id, 'iwp_client_network_admin_install'); 1105 1106 553 delete_blog_option($blog_id, 'iwp_client_nossl_key'); 1107 1108 554 delete_blog_option($blog_id, 'iwp_client_public_key'); 1109 1110 555 delete_blog_option($blog_id, 'iwp_client_action_message_id'); 1111 1112 556 delete_blog_option($blog_id, 'iwp_client_maintenace_mode'); 1113 1114 557 } 1115 1116 558 } 1117 1118 559 } else { 1119 1120 560 if( $deactivate ) 1121 1122 561 delete_option('iwp_client_network_admin_install'); 1123 1124 562 1125 1126 563 delete_option('iwp_client_nossl_key'); 1127 1128 564 delete_option('iwp_client_public_key'); 1129 1130 565 delete_option('iwp_client_action_message_id'); 1131 1132 566 } 1133 1134 567 } 1135 1136 568 } else { 1137 1138 569 delete_option('iwp_client_nossl_key'); 1139 1140 570 delete_option('iwp_client_public_key'); 1141 1142 571 delete_option('iwp_client_action_message_id'); 1143 1144 } 1145 1146 1147 572 } 573 1148 574 //Delete options 1149 1150 575 delete_option('iwp_client_maintenace_mode'); 1151 1152 576 //delete_option('iwp_client_backup_tasks'); 1153 1154 577 wp_clear_scheduled_hook('iwp_client_backup_tasks'); 1155 1156 578 delete_option('iwp_client_notifications'); 1157 1158 579 wp_clear_scheduled_hook('iwp_client_notifications'); 1159 1160 580 delete_option('iwp_client_brand'); 1161 1162 581 delete_option('iwp_client_pageview_alerts'); 1163 1164 1165 582 1166 583 delete_option('iwp_client_activate_key'); 1167 1168 } 1169 1170 1171 1172 1173 1174 /** 1175 584 } 585 586 587 /** 1176 588 * Constructs a url (for ajax purpose) 1177 1178 * 1179 589 * 1180 590 * @param mixed $base_page 1181 1182 */ 1183 591 */ 1184 592 function construct_url($params = array(), $base_page = 'index.php') 1185 1186 { 1187 593 { 1188 594 $url = "$base_page?_wpnonce=" . wp_create_nonce($this->slug); 1189 1190 595 foreach ($params as $key => $value) { 1191 1192 596 $url .= "&$key=$value"; 1193 1194 } 1195 1196 1197 597 } 598 1198 599 return $url; 1199 1200 } 1201 1202 1203 1204 /** 1205 600 } 601 602 /** 1206 603 * Client update 1207 1208 * 1209 1210 */ 1211 604 * 605 */ 1212 606 function update_client_plugin($params) 1213 1214 { 1215 607 { 1216 608 extract($params); 1217 1218 609 if ($download_url) { 1219 1220 610 @include_once ABSPATH . 'wp-admin/includes/file.php'; 1221 1222 611 @include_once ABSPATH . 'wp-admin/includes/misc.php'; 1223 1224 612 @include_once ABSPATH . 'wp-admin/includes/template.php'; 1225 1226 613 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 1227 1228 614 @include_once ABSPATH . 'wp-admin/includes/screen.php'; 1229 1230 615 1231 1232 616 if (!$this->is_server_writable()) { 1233 1234 617 return array( 1235 1236 618 'error' => 'Failed. please add FTP details for automatic upgrades.' 1237 1238 619 ); 1239 1240 620 } 1241 1242 621 1243 1244 622 ob_start(); 1245 1246 623 @unlink(dirname(__FILE__)); 1247 1248 624 $upgrader = new Plugin_Upgrader(); 1249 1250 625 $result = $upgrader->run(array( 1251 1252 626 'package' => $download_url, 1253 1254 627 'destination' => WP_PLUGIN_DIR, 1255 1256 628 'clear_destination' => true, 1257 1258 629 'clear_working' => true, 1259 1260 630 'hook_extra' => array( 1261 1262 631 'plugin' => 'iwp-client/init.php' 1263 1264 632 ) 1265 1266 633 )); 1267 1268 634 ob_end_clean(); 1269 1270 635 @wp_update_plugins(); 1271 1272 1273 636 1274 637 if (is_wp_error($result) || !$result) { 1275 1276 638 return array( 1277 1278 639 'error' => 'InfiniteWP Client plugin could not be updated.' 1279 1280 640 ); 1281 1282 641 } else { 1283 1284 642 return array( 1285 1286 643 'success' => 'InfiniteWP Client plugin successfully updated.' 1287 1288 644 ); 1289 1290 645 } 1291 1292 } 1293 646 } 1294 647 return array( 1295 1296 648 'error' => 'Bad download path for client installation file.' 1297 1298 649 ); 1299 1300 } 1301 1302 1303 1304 /** 1305 650 } 651 652 /** 1306 653 * Automatically logs in when called from IWP Admin panel 1307 1308 * 1309 1310 */ 1311 654 * 655 */ 1312 656 function automatic_login() 1313 1314 { 1315 657 { 1316 658 $where = isset($_GET['iwp_goto']) ? $_GET['iwp_goto'] : false; 1317 1318 659 $username = isset($_GET['username']) ? $_GET['username'] : ''; 1319 1320 660 $auto_login = isset($_GET['auto_login']) ? $_GET['auto_login'] : 0; 1321 1322 661 $_SERVER['HTTP_REFERER']=''; 1323 1324 662 if( !function_exists('is_user_logged_in') ) 1325 1326 663 include_once( ABSPATH.'wp-includes/pluggable.php' ); 1327 1328 1329 664 1330 665 if (( $auto_login && strlen(trim($username)) && !is_user_logged_in() ) || (isset($this->iwp_mmb_multisite) && $this->iwp_mmb_multisite )) { 1331 1332 666 $signature = base64_decode($_GET['signature']); 1333 1334 667 $message_id = trim($_GET['message_id']); 1335 1336 668 1337 1338 669 $auth = $this->authenticate_message($where . $message_id, $signature, $message_id); 1339 1340 670 if ($auth === true) { 1341 1342 671 1343 1344 672 if (!headers_sent()) 1345 1346 673 header('P3P: CP="CAO PSA OUR"'); 1347 1348 674 1349 1350 675 if(!defined('IWP_MMB_USER_LOGIN')) 1351 1352 676 define('IWP_MMB_USER_LOGIN', true); 1353 1354 677 1355 1356 678 $siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl'); 1357 1358 679 $user = $this->iwp_mmb_get_user_info($username); 1359 1360 680 wp_set_current_user($user->ID); 1361 1362 681 1363 1364 682 if(!defined('COOKIEHASH') || (isset($this->iwp_mmb_multisite) && $this->iwp_mmb_multisite) ) 1365 1366 683 wp_cookie_constants(); 1367 1368 684 1369 1370 685 wp_set_auth_cookie($user->ID); 1371 1372 686 @iwp_mmb_client_header(); 1373 1374 687 1375 1376 688 if((isset($this->iwp_mmb_multisite) && $this->iwp_mmb_multisite ) || isset($_REQUEST['iwpredirect'])){ 1377 1378 689 if(function_exists('wp_safe_redirect') && function_exists('admin_url')){ 1379 1380 690 wp_safe_redirect(admin_url($where)); 1381 1382 691 exit(); 1383 1384 692 } 1385 1386 693 } 1387 1388 694 } else { 1389 1390 695 wp_die($auth['error']); 1391 1392 696 } 1393 1394 697 } elseif( is_user_logged_in() ) { 1395 1396 698 @iwp_mmb_client_header(); 1397 1398 699 if(isset($_REQUEST['iwpredirect'])){ 1399 1400 700 if(function_exists('wp_safe_redirect') && function_exists('admin_url')){ 1401 1402 701 wp_safe_redirect(admin_url($where)); 1403 1404 702 exit(); 1405 1406 703 } 1407 1408 704 } 1409 1410 705 } 1411 1412 } 1413 1414 1415 706 } 707 1416 708 function iwp_mmb_set_auth_cookie( $auth_cookie ){ 1417 1418 709 if(!defined('IWP_MMB_USER_LOGIN')) 1419 1420 710 return false; 1421 1422 1423 711 1424 712 if( !defined('COOKIEHASH') ) 1425 1426 713 wp_cookie_constants(); 1427 1428 1429 714 1430 715 $_COOKIE['wordpress_'.COOKIEHASH] = $auth_cookie; 1431 1432 1433 716 1434 717 } 1435 1436 718 function iwp_mmb_set_logged_in_cookie( $logged_in_cookie ){ 1437 1438 719 if(!defined('IWP_MMB_USER_LOGIN')) 1439 1440 720 return false; 1441 1442 721 1443 1444 722 if( !defined('COOKIEHASH') ) 1445 1446 723 wp_cookie_constants(); 1447 1448 1449 724 1450 725 $_COOKIE['wordpress_logged_in_'.COOKIEHASH] = $logged_in_cookie; 1451 1452 726 } 1453 1454 1455 727 1456 728 function admin_actions(){ 1457 1458 //add_filter('all_plugins', array($this, 'client_replace')); 1459 1460 } 1461 1462 1463 729 add_filter('all_plugins', array($this, 'client_replace')); 730 } 731 1464 732 function client_replace($all_plugins){ 1465 1466 733 $replace = get_option("iwp_client_brand"); 1467 1468 734 if(is_array($replace)){ 1469 1470 735 if($replace['name'] || $replace['desc'] || $replace['author'] || $replace['author_url']){ 1471 1472 736 $all_plugins['iwp-client/init.php']['Name'] = $replace['name']; 1473 1474 737 $all_plugins['iwp-client/init.php']['Title'] = $replace['name']; 1475 1476 738 $all_plugins['iwp-client/init.php']['Description'] = $replace['desc']; 1477 1478 739 $all_plugins['iwp-client/init.php']['AuthorURI'] = $replace['author_url']; 1479 1480 740 $all_plugins['iwp-client/init.php']['Author'] = $replace['author']; 1481 1482 741 $all_plugins['iwp-client/init.php']['AuthorName'] = $replace['author']; 1483 1484 742 $all_plugins['iwp-client/init.php']['PluginURI'] = ''; 1485 1486 743 } 1487 1488 744 1489 1490 745 if($replace['hide']){ 1491 1492 746 if (!function_exists('get_plugins')) { 1493 1494 747 include_once(ABSPATH . 'wp-admin/includes/plugin.php'); 1495 1496 748 } 1497 1498 749 $activated_plugins = get_option('active_plugins'); 1499 1500 750 if (!$activated_plugins) 1501 1502 751 $activated_plugins = array(); 1503 1504 752 if(in_array('iwp-client/init.php',$activated_plugins)) 1505 1506 753 unset($all_plugins['iwp-client/init.php']); 1507 1508 754 } 1509 1510 755 } 1511 1512 756 1513 1514 757 return $all_plugins; 1515 1516 } 1517 1518 1519 758 } 759 1520 760 1521 1522 761 } 1523 1524 762 ?> -
wpguards/trunk/modules/manager/helper.class.php
r872536 r872784 349 349 $current_message = $this->get_client_message_id(); 350 350 351 /*if ((int) $current_message > (int) $message_id) 352 return array( 353 'error' => 'Invalid message recieved. Deactivate and activate the InfiniteWP Client plugin on this site, then remove the website from your InfiniteWP account and add it again.' 354 );*/ 355 351 if(isset($_GET['auto_login'])){//temp fix for stopping reuse of open admin url 352 if ((int) $current_message >= (int) $message_id) 353 return array( 354 'error' => 'Invalid message recieved.' 355 ); 356 } 357 356 358 $pl_key = $this->get_admin_panel_public_key(); 357 359 if (!$pl_key) { -
wpguards/trunk/modules/manager/init.php
r872536 r872784 1 1 <?php 2 /************************************************************ 3 * This plugin was modified by Wordpressgeeks * 4 * Copyright (c) 2013 Wordpressgeeks * 5 * www.revmakx.com * 6 * * 7 ************************************************************/ 2 /* 3 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.2.8 8 Author URI: http://www.revmakx.com 9 */ 8 10 /************************************************************ 9 11 * This plugin was modified by Revmakx * … … 25 27 26 28 if(!defined('IWP_MMB_CLIENT_VERSION')) 27 define('IWP_MMB_CLIENT_VERSION', '1.2. 3');29 define('IWP_MMB_CLIENT_VERSION', '1.2.8'); 28 30 29 31 … … 38 40 39 41 $iwp_mmb_wp_version = $wp_version; 40 //WPGUARDS MODYFICATION41 $iwp_mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));42 $iwp_mmb_plugin_url = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));43 //New Value44 42 $iwp_mmb_plugin_dir = WPGUARDS_MODULES_PATH.'/' . basename(dirname(__FILE__)); 45 43 $iwp_mmb_plugin_url = WPGUARDS_DIR . '/modules/' . basename(dirname(__FILE__)); … … 91 89 if (!isset($HTTP_RAW_POST_DATA)) { 92 90 $HTTP_RAW_POST_DATA = file_get_contents('php://input'); 93 94 } 95 /*$fp = fopen('/home/wpguards//test/public_html/wp-content/plugins/wpguards/iwp-client/activate.txt', 'a'); 96 fwrite($fp, print_r($params, TRUE)); 97 fwrite($fp, print_r($_REQUEST, true)); 98 //fwrite($fp, print_r($_SERVER, true)); 99 fwrite($fp, print_r(unserialize(base64_decode(file_get_contents('php://input'))),true)); 100 fclose($fp); */ 91 } 92 101 93 ob_start(); 102 94 … … 228 220 global $iwp_mmb_core; 229 221 $num = extract($params); 230 222 231 223 if ($num) { 232 224 if (!get_option('iwp_client_action_message_id') && !get_option('iwp_client_public_key')) { 233 225 $public_key = base64_decode($public_key); 234 226 235 fwrite($fp, $public_key);236 227 237 228 if(trim($activation_key) != get_option('iwp_client_activate_key')){ //iwp … … 242 233 if (checkOpenSSL() && !$user_random_key_signing) { 243 234 $verify = openssl_verify($action . $id, base64_decode($signature), $public_key); 244 //fwrite($fp, '<----Weryfy: '.$verify.'-'.$action.$id);245 ///fclose($fp);246 235 if ($verify == 1) { 247 236 $iwp_mmb_core->set_admin_panel_public_key($public_key); … … 292 281 } 293 282 } 294 295 296 283 } 297 284 … … 360 347 { 361 348 global $iwp_mmb_core; 362 die();349 363 350 $iwp_mmb_core->get_backup_instance(); 364 do_action( 'iwp_before_backup', $params ); 365 366 $return = $iwp_mmb_core->backup_instance->backup($params); 367 //Custom Add action 351 $return = $iwp_mmb_core->backup_instance->backup($params); 368 352 369 353 if (is_array($return) && array_key_exists('error', $return)) … … 1186 1170 } 1187 1171 1188 1189 global $iwp_mmb_core;1190 1172 $iwp_mmb_core = new IWP_MMB_Core(); 1191 1173 $mmb_core = 1; 1192 //$iwp_mmb_core->install(true); 1174 1193 1175 if(isset($_GET['auto_login'])) 1194 1176 $iwp_mmb_core->automatic_login(); 1195 1177 1196 1178 if (function_exists('register_activation_hook')) 1179 register_activation_hook( __FILE__ , array( $iwp_mmb_core, 'install' )); 1180 1181 if (function_exists('register_deactivation_hook')) 1182 register_deactivation_hook(__FILE__, array( $iwp_mmb_core, 'uninstall' )); 1197 1183 1198 1184 if (function_exists('add_action')) … … 1206 1192 remove_action( 'login_init', 'send_frame_options_header'); 1207 1193 } 1208 //iwp_mmb_add_site(array('activation_key')) 1194 1209 1195 ?> -
wpguards/trunk/modules/manager/installer.class.php
r872536 r872784 52 52 function install_remote_file($params) 53 53 { 54 54 55 global $wp_filesystem; 55 56 extract($params); … … 91 92 )); 92 93 } 93 94 94 95 if ($activate) { 95 96 if ($type == 'plugins') { 96 97 include_once(ABSPATH . 'wp-admin/includes/plugin.php'); 97 $all_plugins = get_plugins(); 98 foreach ($all_plugins as $plugin_slug => $plugin) { 98 99 wp_cache_delete( 'plugins', 'plugins' ); 100 101 $all_plugins = get_plugins(); 102 foreach ($all_plugins as $plugin_slug => $plugin) { 99 103 $plugin_dir = preg_split('/\//', $plugin_slug); 100 104 foreach ($install_info as $key => $install) { … … 223 227 { 224 228 ob_start(); 225 if (!function_exists('wp_version_check') )229 if (!function_exists('wp_version_check') || !function_exists('get_core_checksums')) 226 230 include_once(ABSPATH . '/wp-admin/includes/update.php'); 227 231 … … 753 757 754 758 if (!in_array($path, $activated_plugins)) { 755 $plugins['inactive'][$br_i]['path'] = $path;756 $plugins['inactive'][$br_i]['name'] = strip_tags($plugin['Name']);759 $plugins['inactive'][$br_i]['path'] = $path; 760 $plugins['inactive'][$br_i]['name'] = strip_tags($plugin['Name']); 757 761 $plugins['inactive'][$br_i]['version'] = $plugin['Version']; 758 762 $br_i++; -
wpguards/trunk/modules/manager/lib/dropbox.php
r872536 r872784 1 1 <?php 2 class Dropbox {2 class IWP_Dropbox { 3 3 const API_URL = 'https://api.dropbox.com/'; 4 4 const API_CONTENT_URL = 'https://api-content.dropbox.com/'; … … 43 43 $file = str_replace("\\", "/",$file); 44 44 if (!is_readable($file) or !is_file($file)) 45 throw new DropboxException("Error: File \"$file\" is not readable or doesn't exist.");45 throw new IWP_DropboxException("Error: File \"$file\" is not readable or doesn't exist."); 46 46 $filesize=filesize($file); 47 47 if ($filesize < (1024*1024*50)) { //chunk transfer on bigger uploads <50MB … … 59 59 $file = str_replace("\\", "/",$file); 60 60 if (!is_readable($file) or !is_file($file)) 61 throw new DropboxException("Error: File \"$file\" is not readable or doesn't exist.");61 throw new IWP_DropboxException("Error: File \"$file\" is not readable or doesn't exist."); 62 62 $file_handle=fopen($file,'r'); 63 63 $uploadid=null; … … 106 106 public function search($path = '', $query , $fileLimit = 1000){ 107 107 if (strlen($query)>=3) 108 throw new DropboxException("Error: Query \"$query\" must three characters long.");108 throw new IWP_DropboxException("Error: Query \"$query\" must three characters long."); 109 109 $url = self::API_URL.self::API_VERSION_URL.'search/'.$this->root.'/'.trim($path,'/'); 110 110 return $this->request($url, array('query' => $query, 'file_limit' => $fileLimit)); … … 155 155 elseif (0!=curl_errno($ch)) $message = '('.curl_errno($ch).') '.curl_error($ch); 156 156 else $message = '('.$status.') Invalid response.'; 157 throw new DropboxException($message);157 throw new IWP_DropboxException($message); 158 158 } 159 159 curl_close($ch); … … 189 189 elseif (0!=curl_errno($ch)) $message = '('.curl_errno($ch).') '.curl_error($ch); 190 190 else $message = '('.$status.') Invalid response.'; 191 throw new DropboxException($message);191 throw new IWP_DropboxException($message); 192 192 } 193 193 } … … 258 258 elseif ($status['http_code']==507) $message = '(507) User is over Dropbox storage quota.'; 259 259 else $message = '('.$status['http_code'].') Invalid response.'; 260 throw new DropboxException($message);260 throw new IWP_DropboxException($message); 261 261 } else { 262 262 curl_close($ch); … … 281 281 } 282 282 283 class DropboxException extends Exception {283 class IWP_DropboxException extends Exception { 284 284 } 285 285 ?> -
wpguards/trunk/modules/manager/pclzip.class.php
r872536 r872784 5716 5716 // -------------------------------------------------------------------------------- 5717 5717 5718 5719 5718 ?> -
wpguards/trunk/readme.txt
r872665 r872784 5 5 Requires at least: 3.6 6 6 Tested up to: 3.8.1 7 Stable tag: 1. 1.17 Stable tag: 1.2.0 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 WPGuards plugin is the complete solution for everyone who have a WordPress blog. We'll made automatic backups of your website and provide proffessional support so you can ask us about anything anytime directly from your WordPress administration panel. Also we provide the Uptime monitoring, several diagnostic tools, the Security monitoring and more 15 WPGuards plugin is the complete solution for everyone who have a WordPress blog. We'll made automatic backups of your website and provide proffessional support so you can ask us about anything anytime directly from your WordPress administration panel. Also we provide the Uptime monitoring, several diagnostic tools, the Security monitoring and more. 16 16 17 **Automated Backups** 17 **See [Detailed installation instruction [PDF]](http://wpguards.com/downloads/WPGuards-Installation-and-General-Overview.pdf)** 18 19 = Automated Backups = 18 20 Your site was attacked and you lost your files? Or maybe you accidentally deleted some of your photos? No matter how big problem you have, you can trust our system. Files on your FTP server and entire database can be restored just by 1 click in the WordPress Administration Panel. And if you lost your WordPress website there is complete backup waiting for you on the Dropbox account. 19 21 20 **Uptime Monitoring** 22 = Uptime Monitoring = 21 23 Do you like to know what's going on with your website? Is 99,9% uptime declared by your provider true? You can easily find it out! Your website will be automatically added to the Uptime Monitor. And what if your website will be down? You'll get email notification right away! 22 24 23 **Awesome Support** 25 = Awesome Support = 24 26 WordPress is our life so you can be sure we know how to help you. There are few people waiting for hearing from you. By WPGuards plugin we'll automatically get all needed informations for fast support. You don't have to search for the version of WordPress you're using - let us do the work. 25 27 26 **Security Scans** 28 = Security Scans = 27 29 WPGuards plugin also provide advanced security scan system which will scan your website every day and you can sleep easy. We'll let you know. 28 30 29 **Plugin Updates** 31 = Plugin Updates = 30 32 WordPress auto-updates seems not to work? No problem, we'll update your WordPress, Themes, Plugins and Translations manually. We'll also check if everything is ok with your website after updates. That means no more PHP errors and no lost visitors. 31 33 32 **There are also premium version of the plugin** 34 = There are also premium version of the plugin = 33 35 Please go to [wpguards.com](http://wpguards.com) to see detailed plans and features. 34 36 35 **[Client Panel](https://api.wpguards.com/panel)** 37 **[Client Panel](https://api.wpguards.com/panel)** | **[Official website](http://wpguards.com/)** | **[Detailed installation instruction [PDF]](http://wpguards.com/downloads/WPGuards-Installation-and-General-Overview.pdf)** 36 38 37 39 == Installation == … … 43 45 44 46 == Frequently Asked Questions == 47 48 = Why you want me to register an account? = 49 50 Plugin is useless withouit API key. With API key your website are connected to our API to perform backups, malware scans and plugin authentication. It's complete safe (Encrypted SSL connection) 45 51 46 52 = What is this plugin? = … … 75 81 == Changelog == 76 82 83 = 1.2.0 - 10.3.2014 = 84 * Updated IWP Client 85 77 86 = 1.1.1 - 9.3.2014 = 78 87 * Forked IWP client … … 81 90 == Upgrade Notice == 82 91 92 = 1.2.0 = 93 Improved security 94 83 95 = 1.1.1 = 84 96 Better integration with IWP and improved unistallation security -
wpguards/trunk/wpguards.php
r872536 r872784 4 4 * Plugin URI: http://wpguards.com 5 5 * Description: WordPress Support and Maintenance on Autopilot 6 * Version: 1. 1.16 * Version: 1.2.0 7 7 * Author: WordPressGeeks 8 8 * Author URI: http://wordpressgeeks.co.uk
Note: See TracChangeset
for help on using the changeset viewer.