diff --git a/cloudflare_users/domains/README.md b/cloudflare_users/domains/README.md index ec3e33e41..e3ed29b26 100644 --- a/cloudflare_users/domains/README.md +++ b/cloudflare_users/domains/README.md @@ -9,10 +9,12 @@ - Bonvolu vidi [INSTRUCTION.md](../../INSTRUCTION.md) por dosiera celo kaj formato specifoj. +- [is_listed_cf(), is_cloudflare_cached()](../../tool/example.json.is_cloudflare.php) ----- # Cloudflare users domain list -- See [INSTRUCTION.md](../../INSTRUCTION.md) for file purpose and format specifications. \ No newline at end of file +- See [INSTRUCTION.md](../../INSTRUCTION.md) for file purpose and format specifications. +- [is_listed_cf(), is_cloudflare_cached()](../../tool/example.json.is_cloudflare.php) diff --git a/tool/example.json.is_cloudflare.php b/tool/example.json.is_cloudflare.php new file mode 100644 index 000000000..104adf607 --- /dev/null +++ b/tool/example.json.is_cloudflare.php @@ -0,0 +1,56 @@ + +$vi_opt_timeB = $_GET['tib']??$_POST['tib']; +if (!preg_match("/^2([0-9]{3})\-([0-9]{2})\-([0-9]{2})$/", $vi_opt_timeB)) { + $vi_opt_timeB = ''; +} //<-B +$vi_internal_tia = $vi_internal_tib = ''; +if ($vi_opt_timeA != '') { + $vi_internal_tia = gmdate('U', strtotime($vi_opt_timeA . ' 00:00:00')); + if ($vi_internal_tia > NOWTIME_U) { + $vi_internal_tia = NOWTIME_U; + } +} +if ($vi_opt_timeB != '') { + $vi_internal_tib = gmdate('U', strtotime($vi_opt_timeB . ' 23:59:59')); + if ($vi_internal_tib > NOWTIME_U) { + $vi_internal_tib = NOWTIME_U; + } +} +if (isset($vi_query)) { + $vi_query = cleanse_str($vi_query); + if (is_attackable_str($vi_query)) { + $vi_query = ''; + } +} +$vi_showquery = htmlspecialchars($vi_query, ENT_QUOTES); +$sql_Result = []; +if (strlen($vi_query) >= 2) { + $sqlme = @new mysqli('localhost', 'REDACTED', 'REDACTED', 'REDACTED'); + if ($sqlme->connect_errno) { + echo ('DB ERROR TRY AGAIN LATER'); + exit; + } + $sql_Query = 'SELECT * FROM REDACTED WHERE '; + $sql_Pcs = []; + $sql_smt = ($vi_opt_sm == 'a') ? 'who' : 'body'; + if (!$vi_opt_inclcf) { + $sql_Pcs[] = "iscf = '0' "; + } + if ($vi_opt_limitlg != '') { + $sql_Pcs[] = "lang = '{$vi_opt_limitlg}' "; + } + if ($vi_internal_tia != '') { + $sql_Pcs[] = "`when` >= '{$vi_internal_tia}' "; + } + if ($vi_internal_tib != '') { + $sql_Pcs[] = "`when` <= '{$vi_internal_tib}' "; + } + foreach (explode(' ', $vi_query) as $w) { + if (strlen($w) <= 1) { + continue; + } + if (strpos($w, 'author:') === 0) { + $w = str_replace('author:', '', $w); + if (strlen($w) < 2) { + continue; + } + $sql_Pcs[] = "who LIKE '%{$w}%' "; + continue; + } + if (strpos($w, '-author:') === 0) { + $w = str_replace('-author:', '', $w); + if (strlen($w) < 2) { + continue; + } + $sql_Pcs[] = "who NOT LIKE '%{$w}%' "; + continue; + } + if (strpos($w, '-') === 0) { + $w = str_replace('-', '', $w); + if (strlen($w) < 2) { + continue; + } + $sql_Pcs[] = "{$sql_smt} NOT LIKE '%{$w}%' "; + continue; + } + $sql_Pcs[] = "{$sql_smt} LIKE '%{$w}%' "; + } + if ($result = $sqlme->query($sql_Query . implode('AND ', $sql_Pcs) . ' ORDER BY `when` DESC LIMIT 500;')) { + while ($g = $result->fetch_array()) { + $sql_Result[] = $g; + } + } + $sqlme->close(); +} +if (isset($vi_json)) { + header('Content-Type: application/json; charset=utf-8'); + $finalRESP = []; + if ($vi_showquery == '') { + $finalRESP = ['method' => ['POST', 'GET'], 'accept_param' => ['q' => ['type' => 'string', 'value' => 'any', 'note' => 'Required'], 'sm' => ['type' => 'string', 'value' => ['a' => 'Account', 't' => 'Toot'], 'note' => 'default is t'], 'cf' => ['type' => 'existence', 'value' => 'any'], 'lg' => ['type' => 'string', 'value' => '2 letter'], 'tia' => ['type' => 'date', 'value' => 'Y-m-d'], 'tib' => ['type' => 'date', 'value' => 'Y-m-d']], 'example' => ['GET' => ['/?json&q=friend', '/?json&cf&lg=en&q=news']]]; + } else { + foreach ($sql_Result as $g) { + $finalRESP[] = ['url' => $g['url'], 'who' => $g['who'], 'when' => $g['when'], 'iscf' => $g['iscf'], 'lang' => $g['lang'], 'body' => str_replace(' ', ' ', $g['body']) ]; + } + } + echo (json_encode($finalRESP)); + exit; +} else { + header('Content-Type: text/html; charset=UTF-8'); + $finalRESP = ''; + foreach ($sql_Result as $g) { + $finalRESP.= '' . $g['who'] . '' . ($g['iscf'] ? '🌩' : '') . '
' . humanTiming($g['when']) . ' ago / ' . $g['lang'] . '' . htmlspecialchars(htmlspecialchars_decode(str_replace(' ', ' ', $g['body']), ENT_QUOTES), ENT_QUOTES) . ''; + } + $ui_sma = ($vi_opt_sm == 'a') ? ['', ' selected'] : [' selected', '']; + $ui_cfc = ($vi_opt_inclcf) ? ' checked' : ''; + $finish = << + + 🐘 + + + +
+
+ +
+
+ Advanced +

+ Search mode:
+

+
+

+ Limit language code: (e.g de)
+

+ Limit time range:
+
+
+
+


+
    +
  • cat pic (search toots about "cat" and "pic")
  • +
  • my friend -enemy -joke (search "my" and "friend" toots but not include "enemy" "joke")
  • +
  • news -author:bot -author:blog (search "news" but not from author named "*bot*" "*blog*")
  • +
  • author:friend@my.site (show only about friend@my.site)
  • +
  • Max limit: 500 search results
  • +
+

+
+
+
+







+
+ {$finalRESP}
+
+
+ +
+ + +HTMLDATA; +} +echo (str_replace("\n", '', $finish)); \ No newline at end of file