Same name in other branches
  1. 7.x-2.x advagg.admin.inc \advagg_admin_toggle_bypass_cookie()

Set or remove the AdvAggDisabled cookie.

File

includes/admin.inc, line 728

Code

function advagg_admin_toggle_bypass_cookie() {
    global $base_path;
    $cookie_name = 'AdvAggDisabled';
    $key = md5(drupal_get_private_key());
    // If the cookie does exist then remove it.
    if (!empty($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] == $key) {
        setcookie($cookie_name, '', -1, $base_path, '.' . $_SERVER['HTTP_HOST']);
        unset($_COOKIE[$cookie_name]);
        drupal_set_message(t('AdvAgg Bypass Cookie Removed.'));
    }
    else {
        setcookie($cookie_name, $key, 0, $base_path, '.' . $_SERVER['HTTP_HOST']);
        $_COOKIE[$cookie_name] = $key;
        drupal_set_message(t('AdvAgg Bypass Cookie Set.'));
    }
}