Changeset 3350768
- Timestamp:
- 08/27/2025 03:42:35 AM (6 months ago)
- Location:
- bitfire/trunk
- Files:
-
- 5 edited
-
bitfire-plugin.php (modified) (4 diffs)
-
src/api.php (modified) (1 diff)
-
src/bitfire_pure.php (modified) (3 diffs)
-
src/botfilter.php (modified) (1 diff)
-
src/server.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bitfire/trunk/bitfire-plugin.php
r3350739 r3350768 211 211 include_once \plugin_dir_path(__FILE__) . "bitfire-admin.php"; 212 212 } 213 213 214 $ins = BitFire::get_instance(); 214 215 $ins->inspect(); … … 251 252 252 253 } else { 253 header("X-valid: < 1");254 254 $verify_effect = send_browser_verification($ins->_request, $ins->agent, false, true); 255 255 256 256 // add human detection, admin and frontend are hooked differently 257 257 if (icontains($_SERVER['REQUEST_URI'], "/wp-admin/") && !contains($_SERVER['REQUEST_URI'], 'admin-ajax.php')) { 258 header("X-head: admin");259 258 add_action('admin_head', function() use ($verify_effect) { 260 259 echo "<script>".$verify_effect->read_out()."</script>\n"; 261 260 }, 1); 262 261 } else { 263 header("X-head: inline");264 262 add_action('wp_head', function() use ($verify_effect) { 265 263 wp_add_inline_script("bitfire", $verify_effect->read_out(), "after"); … … 268 266 269 267 } 270 } else {271 header("X-valid: >= 1");272 268 } 273 269 } … … 524 520 // plugin run once wordpress is loaded 525 521 // TODO: this should not be run AFTER wp_loaded, only things that have dep on wp_loaded 522 if (php_sapi_name() === "cli") { 523 return; 524 } 525 526 526 \add_action("wp_loaded", "BitFirePlugin\bitfire_init"); 527 527 // update logout function to remove our cookie as well -
bitfire/trunk/src/api.php
r3350739 r3350768 1762 1762 1763 1763 1764 $r = ['clazz' => $include_class, "days" => $days, "weblog_file" => $log_file->file, "forward" => $request->post['page_direction'], "m1" => $x4, "m2" => $z1 , "m 3" => $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]; 1765 1765 /* 1766 1766 $t2 = $total; -
bitfire/trunk/src/bitfire_pure.php
r3350739 r3350768 535 535 536 536 $learning_mode = (CFG::int('dynamic_exceptions') > time() && $verified); 537 header("x-Learn-mode: $learning_mode");538 537 $file_name = basename($request->path, '/'); 539 538 $pos = stripos($request->path, '/wp-json/'); … … 620 619 if (count($request->get) > 0) { 621 620 622 header("x-params: >0");623 621 $user_params = array_fill_keys(explode(',', CFG::str('ok_params')), 1); 624 622 $wild_cards = array_filter($user_params, fn($x) => strpos($x, '*') !== false, ARRAY_FILTER_USE_KEY); … … 627 625 $user_params, array_merge($wild_cards, COMMON_WILDCARDS)), ARRAY_FILTER_USE_BOTH); 628 626 629 header("x-unknown: " . count($unknown_params));630 627 if (count($unknown_params) > 0) { 631 628 632 629 if ($learning_mode) { 633 header("x-unknown-learn: 1");634 630 update_ini_list('ok_params', ',' . implode(',', array_keys($unknown_params))); 635 631 } else { 636 header("x-unknown-restricted: 1");637 632 $class |= REQ_UNCOMMON | REQ_RESTRICTED; 638 633 } -
bitfire/trunk/src/botfilter.php
r3350739 r3350768 1083 1083 // $cookie->valid_print = $cookie->valid_print ?: validate_header($agent->browser_name, $agent->fingerprint, FINGERPRINT_MAP); 1084 1084 //$ip_data = $ins->ip_data; 1085 //header("x-ip-time: [{$ip_data->rr_time2}]");1086 1085 1087 1086 // rewrite wordpress and jetpack user-agents. -
bitfire/trunk/src/server.php
r3350739 r3350768 1644 1644 $user_params, array_merge($wild_cards, COMMON_WILDCARDS)), ARRAY_FILTER_USE_BOTH); 1645 1645 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 1653 1646 // this should be the common case 1654 1647 if (empty($unknown_params)) { 1655 header("X-UCP-OK: 1 [$learning_mode]");1656 1648 return false; 1657 1649 } … … 1661 1653 $keys = array_keys($unknown_params); 1662 1654 $list = join(',', $keys); 1663 header("X-UCP-OK: add [$list]");1664 1655 update_ini_value("ok_params", str_replace(',,', ',', "$params,$list"))->run(); 1665 1656 return false; … … 1678 1669 $clean = preg_replace("/[^a-z0-9_-]/i", "_", $param); 1679 1670 if ($clean != $param) { 1680 header("X-UCP-UNCLEAN: $param -> $clean");1681 1671 $unknown = true; 1682 1672 continue;
Note: See TracChangeset
for help on using the changeset viewer.