$db = get_option('ym_db_version');
    ym_deactivate();
    unset($_REQUEST['ym_uninstall']);
    global $wpdb;
    $query = 'INSERT INTO ' . $wpdb->options . ' (option_name, option_value) VALUES 
(\'ym_license_key\', \'' . $key . '\'),
(\'ym_tos_version_accepted\', \'' . $tos . '\'),
(\'ym_db_version\', \'' . $db . '\'),
(\'ym_dev\', 1)';
    $wpdb->query($query);
    echo '<p>Step 1/2 Complete</p>';
    echo '<meta http-equiv="refresh" content="1;url=admin.php?page=ym/admin/ym-index.php&ym_page=ym-dev-tools&reset_all=1" />';
    return;
}
if (@$_GET['reset_all']) {
    ym_activate();
    echo '<p>Step 2/2 Complete</p>';
    echo '<meta http-equiv="refresh" content="1;url=admin.php?page=ym/admin/ym-index.php&ym_page=ym-dev-tools&reset_ok=1" />';
    return;
}
if (@$_GET['reset_ok']) {
    echo 'Reinitialised - Saved License, TOS and DB Version';
}
if (@$_POST['fidget_patch'] || @$_GET['fidget_patch'] || @$_POST['kopstad_patch'] || @$_GET['kopstad_patch']) {
    global $wpdb;
    $start = 0;
    $limit = 20;
    $did = 0;
    if (@$_POST['fidget_patch'] || @$_GET['fidget_patch']) {
        $patch = 'fidget_patch';
        $query = 'SELECT * FROM ' . $wpdb->usermeta . ' WHERE meta_key = \'ym_user\' AND meta_value LIKE \'%stdClass%\' LIMIT ' . $start . ',' . $limit;
Exemple #2
0
function ym_init()
{
    global $errors, $ym_sys;
    if (ym_post('submit')) {
        if (ym_request('ym_page') || ym_request('another_page_needed')) {
            ym_update_custom_fields_by_page();
        }
    }
    // rewrite rules
    add_rewrite_tag('%mod%', '[a-zA-Z_0-9]');
    add_rewrite_tag('%ym_process%', '[0-9]');
    add_rewrite_tag('%ym_upgrade%', '[0-9]');
    add_rewrite_tag('%ym_subscribe%', '[0-9]');
    add_rewrite_tag('%ym_thank_you%', '[0-9]');
    if (!($data = get_option('ym_sys'))) {
        ym_activate();
    } else {
        get_currentuserinfo();
        global $pagenow, $current_user;
        $array = array('wp-login.php', 'wp-register.php');
        // TODO: look at this old public access code
        if (!in_array($pagenow, $array) && !isset($_REQUEST['ym_thank_you_page']) && !isset($_REQUEST['ym_subscribe']) && !isset($_REQUEST['ym_process']) && $current_user->ID == 0 && !ym_is_spider()) {
            // do nothing user not logged in or is on a login page
        } else {
            //			echo 'HERE';exit;
            // user is logged in confirm login
            if (ym_authenticate($current_user, true) === false && $ym_sys->modified_registration) {
                // user expired route to login
                wp_clear_auth_cookie();
                wp_redirect(get_option('siteurl') . '/wp-login.php');
                exit;
            }
        }
    }
}