Plugin Directory

Changeset 3350768


Ignore:
Timestamp:
08/27/2025 03:42:35 AM (6 months ago)
Author:
bitslip6
Message:

wp-cli fix

Location:
bitfire/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • bitfire/trunk/bitfire-plugin.php

    r3350739 r3350768  
    211211        include_once \plugin_dir_path(__FILE__) . "bitfire-admin.php";
    212212    }
     213
    213214    $ins = BitFire::get_instance();
    214215    $ins->inspect();
     
    251252
    252253            } else {
    253                 header("X-valid: < 1");
    254254                $verify_effect = send_browser_verification($ins->_request, $ins->agent, false, true);
    255255
    256256                // add human detection, admin and frontend are hooked differently
    257257                if (icontains($_SERVER['REQUEST_URI'], "/wp-admin/") && !contains($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
    258                     header("X-head: admin");
    259258                    add_action('admin_head', function() use ($verify_effect) {
    260259                        echo "<script>".$verify_effect->read_out()."</script>\n";
    261260                    }, 1);
    262261                } else {
    263                     header("X-head: inline");
    264262                    add_action('wp_head', function() use ($verify_effect) {
    265263                        wp_add_inline_script("bitfire", $verify_effect->read_out(), "after");
     
    268266
    269267            }
    270         } else {
    271             header("X-valid: >= 1");
    272268        }
    273269    }
     
    524520// plugin run once wordpress is loaded
    525521// TODO: this should not be run AFTER wp_loaded, only things that have dep on wp_loaded
     522if (php_sapi_name() === "cli") {
     523    return;
     524}
     525
    526526\add_action("wp_loaded", "BitFirePlugin\bitfire_init");
    527527// update logout function to remove our cookie as well
  • bitfire/trunk/src/api.php

    r3350739 r3350768  
    17621762
    17631763
    1764     $r = ['clazz' => $include_class, "days" => $days, "weblog_file" => $log_file->file, "forward" => $request->post['page_direction'], "m1" => $x4, "m2" => $z1 , "m3" => $r0, "must_hydrate" => $must_hydrate, "ctr" => $ctr, "t2" => $total, "ln" => $total, "cres" => count($result), "len" => $l, "stime" => date("Y-m-d H:i:s", $start_time), "etime" => date("Y-m-d H:i:s", $end_time), "total" => $total, "skip" => $page_skip, "start" => $page_start, "end" => $page_start + count($result), "ctr" => $ctr, "pos" => $log_file->pos, "m" => $m, "duration" => $t2 - $t1, "data" => $result];
     1764    $r = ['clazz' => $include_class, "days" => $days, "weblog_file" => $log_file->file, "forward" => $request->post['page_direction'], "m1" => $x4, "m2" => $z1 , "must_hydrate" => $must_hydrate, "ctr" => $ctr, "t2" => $total, "ln" => $total, "cres" => count($result), "len" => $l, "stime" => date("Y-m-d H:i:s", $start_time), "etime" => date("Y-m-d H:i:s", $end_time), "total" => $total, "skip" => $page_skip, "start" => $page_start, "end" => $page_start + count($result), "ctr" => $ctr, "pos" => $log_file->pos, "m" => $m, "duration" => $t2 - $t1, "data" => $result];
    17651765    /*
    17661766    $t2 = $total;
  • bitfire/trunk/src/bitfire_pure.php

    r3350739 r3350768  
    535535
    536536    $learning_mode = (CFG::int('dynamic_exceptions') > time() && $verified);
    537     header("x-Learn-mode: $learning_mode");
    538537    $file_name  = basename($request->path, '/');
    539538    $pos  = stripos($request->path, '/wp-json/');
     
    620619    if (count($request->get) > 0) {
    621620
    622         header("x-params: >0");
    623621        $user_params = array_fill_keys(explode(',', CFG::str('ok_params')), 1);
    624622        $wild_cards  = array_filter($user_params, fn($x) => strpos($x, '*') !== false, ARRAY_FILTER_USE_KEY);
     
    627625            $user_params, array_merge($wild_cards, COMMON_WILDCARDS)), ARRAY_FILTER_USE_BOTH);
    628626
    629         header("x-unknown: " . count($unknown_params));
    630627        if (count($unknown_params) > 0) {
    631628
    632629            if ($learning_mode) {
    633                 header("x-unknown-learn: 1");
    634630                update_ini_list('ok_params', ',' . implode(',', array_keys($unknown_params)));
    635631            } else {
    636                 header("x-unknown-restricted: 1");
    637632                $class |= REQ_UNCOMMON | REQ_RESTRICTED;
    638633            }
  • bitfire/trunk/src/botfilter.php

    r3350739 r3350768  
    10831083        // $cookie->valid_print = $cookie->valid_print ?: validate_header($agent->browser_name, $agent->fingerprint, FINGERPRINT_MAP);
    10841084        //$ip_data = $ins->ip_data;
    1085         //header("x-ip-time: [{$ip_data->rr_time2}]");
    10861085
    10871086        // rewrite wordpress and jetpack user-agents.
  • bitfire/trunk/src/server.php

    r3350739 r3350768  
    16441644        $user_params, array_merge($wild_cards, COMMON_WILDCARDS)), ARRAY_FILTER_USE_BOTH);
    16451645
    1646 
    1647 
    1648     header("X-UCP: " . join(',', array_keys($get)));
    1649     header("X-UUP: " . join(',', array_keys($user_params)));
    1650     header("X-UUKP: " . join(',', array_keys($unknown_params)));
    1651 
    1652 
    16531646    // this should be the common case
    16541647    if (empty($unknown_params)) {
    1655         header("X-UCP-OK: 1 [$learning_mode]");
    16561648        return false;
    16571649    }
     
    16611653        $keys = array_keys($unknown_params);
    16621654        $list = join(',', $keys);
    1663         header("X-UCP-OK: add [$list]");
    16641655        update_ini_value("ok_params", str_replace(',,', ',', "$params,$list"))->run();
    16651656        return false;
     
    16781669        $clean = preg_replace("/[^a-z0-9_-]/i", "_", $param);
    16791670        if ($clean != $param) {
    1680             header("X-UCP-UNCLEAN: $param -> $clean");
    16811671            $unknown = true;
    16821672            continue;
Note: See TracChangeset for help on using the changeset viewer.