Пример #1
0
function wpr_sub_options() {
	global $wpdb, $wpr_table_campaigns, $wpr_table_templates, $wpr_table_errors, $wpr_table_posts, $wpr_modules, $_wp_using_ext_object_cache;
	$_wp_using_ext_object_cache = false;

	$options = unserialize(get_option("wpr_options"));	

	if($_POST['wpr_uninstall']) {
		$results = $wpdb->query("DROP TABLE $wpr_table_posts,$wpr_table_templates,$wpr_table_campaigns,$wpr_table_errors;");
		delete_option("wpr_options");
		delete_option("wpr_cron");	
		delete_option("wpr_cloak");	
		delete_option('wpr_db_ver');
		$options = "";
		echo '<div class="updated"><p>'.__('WP Robot has been uninstalled. You can now disable and delete the plugin.<br/><br/><strong>If you intend to reinstall WP Robot please first disable and reenable the plugin on your blogs "Plugins" page - otherwise the installation will not work!</strong>', 'wprobot').'</p></div>';		
	}		
	
	if ($options['wpr_installed'] != "yes") {
		echo '<div class="wrap"><h2>WP Robot</h2><div class="updated"><h3>Installation</h3><p>'.__('Please go <a href="?page=wpr-campaigns">here</a> to finish the installation of WP Robot first.', 'wprobot').'</p></div></div>';
		return false;
	}		
	
	if($_POST['wpr_options_default']) {
		$options = wpr_default_options(1);
		echo '<div class="updated"><p>'.__('Options have been reset.', 'wprobot').'</p></div>';			
	}		
	
	if($_POST['wpr_templates_default']) {
		$results = $wpdb->query("TRUNCATE TABLE $wpr_table_templates;");
		$sql = unserialize(get_option("wpr_sql"));
		if(empty($sql)) {$sql = $options["wpr_sql"];}
		$results2 = $wpdb->query($sql);
		if($results2) {echo '<div class="updated"><p>'.__('Templates have been reset.', 'wprobot').'</p></div>';}	
		else {echo '<div class="updated"><p>'.__('Templates could not be reset.', 'wprobot').'</p></div>';}
	}			
	
	if($_POST['wpr_import']) {
		$options = wpr_import_options();			
		echo '<div class="updated"><p>'.__('Settings have been imported.', 'wprobot').'</p></div>';		
	}		

	if($_POST['wpr_clear_log']) {
		$results = $wpdb->query("TRUNCATE TABLE $wpr_table_errors;");
		echo '<div class="updated"><p>'.__('Log has been cleared.', 'wprobot').'</p></div>';		
	}		

	if($_POST['wpr_clear_posts']) {
		$results = $wpdb->query("TRUNCATE TABLE $wpr_table_posts;");			
		echo '<div class="updated"><p>'.__('History has been cleared.', 'wprobot').'</p></div>';		
	}
	
	if($_POST['wpr_update_email']) {
		$options['wpr_email'] = wpr_update_email($options['wpr_email'],$_POST['wpr_email']);
	}
	
	if($_POST['wpr_update_core']) {	
		wpr_update_email($options['wpr_email'],$options['wpr_email'],1);		
	}
	
	if($_POST['wpr_options_save']) {
	
		if($_POST['wpr_cloak'] == "Yes" && get_option('wpr_cloak') != "Yes") {
		echo '<div class="updated"><p>'.__('<b>Warning:</b> Link cloaking has been enabled but <a href="http://wprobot.net/blog/how-to-set-up-wp-robot-link-cloaking/">additional steps</a> are required to finish the setup. If you do not follow these steps affiliate links on your blog will not work!', 'wprobot').'</p></div>';			
		}
	
		$options['wpr_resetcount'] = $_POST['wpr_resetcount'];
		$options['wpr_autotag'] = $_POST['wpr_autotag'];
		$options['wpr_badwords'] = $_POST['wpr_badwords'];
		$options['wpr_randomize'] = $_POST['wpr_randomize'];
		$options['wpr_randomize_comments'] = $_POST['wpr_randomize_comments'];
		$options['wpr_help'] = $_POST['wpr_help'];
		$options['wpr_poststatus'] = $_POST['wpr_poststatus'];
		$options['wpr_cb_affkey'] = $_POST['wpr_cb_affkey'];		
		$options['wpr_cb_filter'] = $_POST['wpr_cb_filter'];	
		$options['wpr_openlinks'] = $_POST['wpr_openlinks'];
		$options['wpr_authorid'] = $_POST['wpr_authorid'];	
		$options['wpr_err_retries'] = $_POST['wpr_err_retries'];
		$options['wpr_err_maxerr'] = $_POST['wpr_err_maxerr'];
		$options['wpr_err_minmod'] = $_POST['wpr_err_minmod'];	
		$options['wpr_err_disable'] = $_POST['wpr_err_disable'];
		$options["wpr_global_exclude"] = $_POST['wpr_global_exclude'];
		$options['wpr_check_unique_old'] = $_POST['wpr_check_unique_old'];
		$options['wpr_simple'] = $_POST['wpr_simple'];
		//$options['wpr_rewrite_active'] = $_POST['wpr_rewrite_active'];	
		$options['wpr_rewrite_active_tbs'] = $_POST['wpr_rewrite_active_tbs'];
		$options['wpr_rewrite_active_sc'] = $_POST['wpr_rewrite_active_sc'];
		$options['wpr_rewrite_active_schimp'] = $_POST['wpr_rewrite_active_schimp'];
		$options['wpr_rewrite_active_ucg'] = $_POST['wpr_rewrite_active_ucg'];	
		$options['wpr_rewrite_active_sr'] = $_POST['wpr_rewrite_active_sr'];	
		$options['wpr_rewrite_active_wai'] = $_POST['wpr_rewrite_active_wai'];			
		$options['wpr_rewrite_email'] = $_POST['wpr_rewrite_email'];
		$options['wpr_rewrite_key'] = $_POST['wpr_rewrite_key'];
		$options['wpr_rewrite_level'] = $_POST['wpr_rewrite_level'];
		$options['wpr_save_images'] = $_POST['wpr_save_images'];
		$options['wpr_tbs_rewrite_email'] = $_POST['wpr_tbs_rewrite_email'];
		$options['wpr_tbs_rewrite_pw'] = $_POST['wpr_tbs_rewrite_pw'];	
		$options['wpr_tbs_spintxt'] = $_POST['wpr_tbs_spintxt'];	
		$options['wpr_tbs_quality'] = $_POST['wpr_tbs_quality'];
		$options['wpr_tbs_rewrite_title'] = $_POST['wpr_tbs_rewrite_title'];
		$options['wpr_rewrite_protected'] = $_POST['wpr_rewrite_protected'];
		$options['wpr_sc_rewrite_email'] = $_POST['wpr_sc_rewrite_email'];
		$options['wpr_sc_rewrite_pw'] = $_POST['wpr_sc_rewrite_pw'];
		$options['wpr_sc_quality'] = $_POST['wpr_sc_quality'];
		$options['wpr_sc_port'] = $_POST['wpr_sc_port'];
		$options['wpr_sc_thesaurus'] = $_POST['wpr_sc_thesaurus'];
		$options['wpr_schimp_rewrite_email'] = $_POST['wpr_schimp_rewrite_email'];
		$options['wpr_schimp_rewrite_pw'] = $_POST['wpr_schimp_rewrite_pw'];
		$options['wpr_schimp_quality'] = $_POST['wpr_schimp_quality'];	
		$options['wpr_sr_rewrite_email'] = $_POST['wpr_sr_rewrite_email'];	
		$options['wpr_sr_rewrite_pw'] = $_POST['wpr_sr_rewrite_pw'];	
		$options['wpr_sr_quality'] = $_POST['wpr_sr_quality'];	
		$options['wpr_wai_rewrite_email'] = $_POST['wpr_wai_rewrite_email'];	
		$options['wpr_wai_rewrite_pw'] = $_POST['wpr_wai_rewrite_pw'];	
		$options['wpr_wai_quality'] = $_POST['wpr_wai_quality'];			
		$options['wpr_trans_use_proxies'] = $_POST['wpr_trans_use_proxies'];	
		$options['wpr_trans_proxies'] = $_POST['wpr_trans_proxies'];	
		foreach($wpr_modules as $module) {
			$function = "wpr_".$module."_options_default";
			if(function_exists($function)) {
				$moptions = $function();
				foreach($moptions as $moption => $default) {
					$options[$moption] = $_POST[$moption];
				}
			}
		}
		update_option("wpr_options", serialize($options));	
		update_option('wpr_cloak',$_POST['wpr_cloak']);
		echo '<div class="updated"><p>'.__('Options have updated.', 'wprobot').'</p></div>';				
	}	
	
	include("display-options.php");	
}
Пример #2
0
function wpr_sub_options()
{
    global $wpdb, $wpr_table_campaigns, $wpr_table_templates, $wpr_table_errors, $wpr_table_posts, $modules;
    $options = unserialize(get_option("wpr_options"));
    if ($_POST['wpr_uninstall']) {
        $results = $wpdb->query("DROP TABLE {$wpr_table_posts},{$wpr_table_templates},{$wpr_table_campaigns},{$wpr_table_errors};");
        delete_option("wpr_options");
        delete_option("wpr_cron");
        delete_option("wpr_cloak");
        delete_option('wpr_db_ver');
        $options = "";
        echo '<div class="updated"><p>' . __('WP Robot has been uninstalled. You can now disable and delete the plugin.', 'wprobot') . '</p></div>';
    }
    if ($options['wpr_installed'] != "yes") {
        echo '<div class="wrap"><h2>WP Robot</h2><div class="updated"><h3>Installation</h3><p>' . __('Please go <a href="?page=wpr-campaigns">here</a> to finish the installation of WP Robot first.', 'wprobot') . '</p></div></div>';
        return false;
    }
    if ($_POST['wpr_options_default']) {
        $options = wpr_default_options(1);
        echo '<div class="updated"><p>' . __('Options have been reset.', 'wprobot') . '</p></div>';
    }
    if ($_POST['wpr_templates_default']) {
        $results = $wpdb->query("TRUNCATE TABLE {$wpr_table_templates};");
        if ($results) {
            $results2 = $wpdb->query($options["wpr_sql"]);
        }
        if ($results2) {
            echo '<div class="updated"><p>' . __('Templates have been reset.', 'wprobot') . '</p></div>';
        } else {
            echo '<div class="updated"><p>' . __('Templates could not be reset.', 'wprobot') . '</p></div>';
        }
    }
    if ($_POST['wpr_import']) {
        $options = wpr_import_options();
        echo '<div class="updated"><p>' . __('Settings have been imported.', 'wprobot') . '</p></div>';
    }
    if ($_POST['wpr_clear_log']) {
        $results = $wpdb->query("TRUNCATE TABLE {$wpr_table_errors};");
        echo '<div class="updated"><p>' . __('Log has been cleared.', 'wprobot') . '</p></div>';
    }
    if ($_POST['wpr_clear_posts']) {
        $results = $wpdb->query("TRUNCATE TABLE {$wpr_table_posts};");
        echo '<div class="updated"><p>' . __('History has been cleared.', 'wprobot') . '</p></div>';
    }
    if ($_POST['wpr_update_email']) {
        $options['wpr_email'] = wpr_update_email($options['wpr_email'], $_POST['wpr_email']);
    }
    if ($_POST['wpr_options_save']) {
        $options['wpr_resetcount'] = $_POST['wpr_resetcount'];
        $options['wpr_autotag'] = $_POST['wpr_autotag'];
        $options['wpr_badwords'] = $_POST['wpr_badwords'];
        $options['wpr_randomize'] = $_POST['wpr_randomize'];
        $options['wpr_randomize_comments'] = $_POST['wpr_randomize_comments'];
        $options['wpr_help'] = $_POST['wpr_help'];
        $options['wpr_poststatus'] = $_POST['wpr_poststatus'];
        $options['wpr_cb_affkey'] = $_POST['wpr_cb_affkey'];
        $options['wpr_cb_filter'] = $_POST['wpr_cb_filter'];
        $options['wpr_openlinks'] = $_POST['wpr_openlinks'];
        $options['wpr_authorid'] = $_POST['wpr_authorid'];
        $options['wpr_err_retries'] = $_POST['wpr_err_retries'];
        $options['wpr_err_maxerr'] = $_POST['wpr_err_maxerr'];
        $options['wpr_err_minmod'] = $_POST['wpr_err_minmod'];
        $options['wpr_err_disable'] = $_POST['wpr_err_disable'];
        $options["wpr_global_exclude"] = $_POST['wpr_global_exclude'];
        $options['wpr_check_unique_old'] = $_POST['wpr_check_unique_old'];
        foreach ($modules as $module) {
            $function = "wpr_" . $module . "_options_default";
            if (function_exists($function)) {
                $moptions = $function();
                foreach ($moptions as $moption => $default) {
                    $options[$moption] = $_POST[$moption];
                }
            }
        }
        update_option("wpr_options", serialize($options));
        update_option('wpr_cloak', $_POST['wpr_cloak']);
        echo '<div class="updated"><p>' . __('Options have updated.', 'wprobot') . '</p></div>';
    }
    include "display-options.php";
}