芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/public_html/wp-content/plugins/wpvivid-backuprestore/wpvivid-backuprestore.php
\r\nRewriteEngine On\r\nRewriteRule .* - [F,L]\r\n"; fwrite($tempfile,$text ); fclose($tempfile); } } if(!is_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir)) { @mkdir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir,0777,true); @fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir.DIRECTORY_SEPARATOR.'index.html', 'x'); $tempfile=@fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir.DIRECTORY_SEPARATOR.'.htaccess', 'x'); if($tempfile) { $text="
\r\nRewriteEngine On\r\nRewriteRule .* - [F,L]\r\n
"; fwrite($tempfile,$text ); fclose($tempfile); } } if(!is_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir.DIRECTORY_SEPARATOR.'error')) { @mkdir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir.DIRECTORY_SEPARATOR.'error',0777,true); @fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir.DIRECTORY_SEPARATOR.'error'.DIRECTORY_SEPARATOR.'index.html', 'x'); $tempfile=@fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_log_dir.DIRECTORY_SEPARATOR.'error'.DIRECTORY_SEPARATOR.'.htaccess', 'x'); if($tempfile) { $text="
\r\nRewriteEngine On\r\nRewriteRule .* - [F,L]\r\n
"; fwrite($tempfile,$text ); fclose($tempfile); } } //A flag to determine whether plugin had been initialized $init=get_option('wpvivid_init', 'not init'); if($init=='not init') { include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-setting.php'; //Initialization settings WPvivid_Setting::init_option(); update_option('wpvivid_init','init','no'); } $wpvivid_remote_init=get_option('wpvivid_remote_init', 'not init'); if($wpvivid_remote_init=='not init') { include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-setting.php'; wpvivid_init_remote_option(); update_option('wpvivid_remote_init','init','no'); } add_option('wpvivid_do_activation_redirect', true); } function wpvivid_init_plugin_redirect() { if (get_option('wpvivid_do_activation_redirect', false)) { delete_option('wpvivid_do_activation_redirect'); $active_plugins = get_option('active_plugins'); if(!function_exists('get_plugins')) require_once(ABSPATH . 'wp-admin/includes/plugin.php'); $plugins=get_plugins(); $pro_wpvivid_slug='wpvivid-backup-pro/wpvivid-backup-pro.php'; $b_redirect_pro=false; if(!empty($plugins)) { if(isset($plugins[$pro_wpvivid_slug])) { if(in_array($pro_wpvivid_slug, $active_plugins)) { $b_redirect_pro=true; } } } if($b_redirect_pro) { $url=apply_filters('wpvivid_backup_activate_redirect_url','admin.php?page=wpvivid-dashboard'); if (is_multisite()) { wp_redirect(network_admin_url().$url); } else { wp_redirect(admin_url().$url); } } else { $url=apply_filters('wpvivid_backup_activate_redirect_url','admin.php?page=WPvivid'); if (is_multisite()) { wp_redirect(network_admin_url().$url); } else { wp_redirect(admin_url().$url); } } } } function wpvivid_init_remote_option() { $remoteslist=WPvivid_Setting::get_all_remote_options(); foreach ($remoteslist as $key=>$value) { if(!array_key_exists('options',$value)) { continue; } $remote = array(); if($value['type'] === 'ftp') { $remote['host']=$value['options']['host']; $remote['username']=$value['options']['username']; $remote['password']=$value['options']['password']; $remote['path']=$value['options']['path']; $remote['name']=$value['options']['name']; $remote['passive']=$value['options']['passive']; $value['type'] = strtolower($value['type']); $remote['type']=$value['type']; $remoteslist[$key]=$remote; } elseif ($value['type'] === 'sftp') { $remote['host']=$value['options']['host']; $remote['username']=$value['options']['username']; $remote['password']=$value['options']['password']; $remote['path']=$value['options']['path']; $remote['name']=$value['options']['name']; $remote['port']=$value['options']['port']; $value['type'] = strtolower($value['type']); $remote['type']=$value['type']; $remoteslist[$key]=$remote; } elseif ($value['type'] === 'amazonS3') { $remote['classMode']='0'; $remote['sse']='0'; $remote['name']=$value['options']['name']; $remote['access']=$value['options']['access']; $remote['secret']=$value['options']['secret']; $remote['s3Path']=$value['options']['s3Path']; $value['type'] = strtolower($value['type']); $remote['type']=$value['type']; $remoteslist[$key]=$remote; } } WPvivid_Setting::update_option('wpvivid_upload_setting',$remoteslist); include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-backuplist.php'; $backuplist=WPvivid_Backuplist::get_backuplist(); foreach ($backuplist as $key=>$value) { if(is_array($value['remote'])) { foreach ($value['remote'] as $remote_key=>$storage_type) { if(!array_key_exists('options',$storage_type)) { continue; } $remote = array(); if($storage_type['type'] === 'ftp') { $remote['host']=$storage_type['options']['host']; $remote['username']=$storage_type['options']['username']; $remote['password']=$storage_type['options']['password']; $remote['path']=$storage_type['options']['path']; $remote['name']=$storage_type['options']['name']; $remote['passive']=$storage_type['options']['passive']; $storage_type['type'] = strtolower($storage_type['type']); $remote['type']=$storage_type['type']; } elseif ($storage_type['type'] === 'sftp') { $remote['host']=$storage_type['options']['host']; $remote['username']=$storage_type['options']['username']; $remote['password']=$storage_type['options']['password']; $remote['path']=$storage_type['options']['path']; $remote['name']=$storage_type['options']['name']; $remote['port']=$storage_type['options']['port']; $storage_type['type'] = strtolower($storage_type['type']); $remote['type']=$storage_type['type']; } elseif ($storage_type['type'] === 'amazonS3') { $remote['classMode']='0'; $remote['sse']='0'; $remote['name']=$storage_type['options']['name']; $remote['access']=$storage_type['options']['access']; $remote['secret']=$storage_type['options']['secret']; $remote['s3Path']=$storage_type['options']['s3Path']; $storage_type['type'] = strtolower($storage_type['type']); $remote['type']=$storage_type['type']; } $backuplist[$key]['remote'][$remote_key]=$remote; } } } WPvivid_Setting::update_option('wpvivid_backup_list',$backuplist); } register_activation_hook(__FILE__, 'wpvivid_plugin_activate'); add_action('admin_init', 'wpvivid_init_plugin_redirect'); /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 0.9.1 */ if(isset($wpvivid_plugin)&&is_a($wpvivid_plugin,'WPvivid')) { return ; } require plugin_dir_path( __FILE__ ) . 'includes/class-wpvivid.php'; function run_wpvivid() { $wpvivid_plugin = new WPvivid(); $GLOBALS['wpvivid_plugin'] = $wpvivid_plugin; } run_wpvivid();