-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
centraldb.php
142 lines (130 loc) · 6.47 KB
/
centraldb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
namespace Antsstyle\NFTCryptoBlocker;
require __DIR__ . '/vendor/autoload.php';
use Antsstyle\NFTCryptoBlocker\Core\Core;
use Antsstyle\NFTCryptoBlocker\Core\CachedVariables;
use Antsstyle\NFTCryptoBlocker\Core\Config;
use Antsstyle\NFTCryptoBlocker\Core\Session;
use Antsstyle\NFTCryptoBlocker\Core\CoreDB;
Session::checkSession();
$pageNum = filter_input(INPUT_GET, "page", FILTER_VALIDATE_INT);
if (is_null($pageNum) || $pageNum === false) {
$pageNum = 1;
}
$centralDBEntriesCount = CoreDB::getCentralDBCount();
$pageCount = ceil($centralDBEntriesCount / 100);
if ($pageNum > $pageCount) {
$pageNum = $pageCount;
}
if ($pageNum < 1) {
$pageNum = 1;
}
$nextPage = $pageNum + 1;
$prevPage = $pageNum - 1;
$centralDBEntriesPage = CoreDB::getSortedCentralDBEntries($pageNum);
$minFollowerCount = CoreDB::getCachedVariable(CachedVariables::CENTRALISEDBLOCKLIST_MIN_FOLLOWERCOUNT);
$minMatchCount = CoreDB::getCachedVariable(CachedVariables::CENTRALISEDBLOCKLIST_MIN_MATCHCOUNT);
?>
<html>
<script src="src/ajax/tables.js"></script>
<script src="src/ajax/dbsearch.js"></script>
<head>
<link rel="stylesheet" href="main.css" type="text/css">
<link rel="stylesheet" href=<?php echo Config::WEBSITE_STYLE_DIRECTORY . "sidebar.css"; ?> type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@antsstyle" />
<meta name="twitter:title" content="NFT Artist & Cryptobro Blocker" />
<meta name="twitter:description" content="Auto-blocks or auto-mutes NFT artists and cryptobros on your timeline and/or in your mentions." />
<meta name="twitter:image" content="<?php echo Config::CARD_IMAGE_URL; ?>" />
</head>
<title>
NFT Artist & Cryptobro Blocker
</title>
<body onload="storeSearchResults()">
<div class="main">
<script src=<?php echo Config::WEBSITE_STYLE_DIRECTORY . "sidebar.js"; ?>></script>
<h2>Central Database Entries</h2>
<p>
<?php
echo "This is the central database of detected NFT/crypto users, sorted by follower count (note that this page will only show detected users with "
. "a minimum of $minFollowerCount followers, who matched filters from users at least $minMatchCount times). ";
?>
</p>
<p>
You can search the entire database (not just this page) by twitter handle using the search box below.
</p>
This is page <?php echo "$pageNum of $pageCount"; ?>.
<?php
if ($prevPage >= 1) {
echo "<button onclick=\"window.location.href = '" . Config::HOMEPAGE_URL . "centraldb?page=" . $prevPage . "';\">"
. "Previous page"
. "</button>";
} else {
echo "<button onclick=\"window.location.href = '" . Config::HOMEPAGE_URL . "centraldb?page=" . $prevPage . "';\" disabled>"
. "Previous page"
. "</button>";
}
echo " ";
if ($nextPage <= $pageCount) {
echo "<button onclick=\"window.location.href = '" . Config::HOMEPAGE_URL . "centraldb?page=" . $nextPage . "';\">"
. "Next page"
. "</button>";
} else {
echo "<button onclick=\"window.location.href = '" . Config::HOMEPAGE_URL . "centraldb?page=" . $nextPage . "';\" disabled>"
. "Next page"
. "</button>";
}
?>
<br/><br/>
<input type="text" id="centraldbsearch" placeholder="Search by twitter handle...">
<button type="button" id="searchbutton" onclick="dbSearch('centraldbsearch', 'central')">Search</button>
<button type="button" id="resetbutton" onclick="resetSearchTable()">Reset</button>
<br/><br/>
<div id="searchresultstextdiv">
</div>
Click a column header to sort by that column.
<br/><br/>
<div id="searchresultsdiv">
<table id="maintable" class="dblisttable">
<tr>
<th onclick="sortTable(0, 'maintable')">Twitter Handle</th>
<th onclick="sortTable(1, 'maintable')">Matched filter type</th>
<th onclick="sortTable(2, 'maintable')">Matched filter content</th>
<th onclick="sortTable(3, 'maintable')">Date added</th>
<th onclick="sortTable(4, 'maintable')">Follower #</th>
<th onclick="sortTable(5, 'maintable')">Match count</th>
</tr>
<?php
if (!$centralDBEntriesPage) {
echo "Error: could not load central database entries.";
} else {
foreach ($centralDBEntriesPage as $centralDBEntry) {
$dateAdded = substr($centralDBEntry['dateadded'], 0, 10);
echo "<tr>";
echo "<td>@" . $centralDBEntry['twitterhandle'] . "</td>";
if ($centralDBEntry['matchedfiltertype'] === "nftprofilepictures") {
$content = $centralDBEntry['matchedfiltercontent'];
$href = "<a href=\"$content\" target=\"_blank\">Link to image</a>";
echo "<td>" . $centralDBEntry['matchedfiltertype'] . "</td>";
echo "<td>" . $href . "</td>";
} else {
echo "<td>" . $centralDBEntry['matchedfiltertype'] . "</td>";
echo "<td>" . $centralDBEntry['matchedfiltercontent'] . "</td>";
}
echo "<td>" . $dateAdded . "</td>";
echo "<td>" . $centralDBEntry['followercount'] . "</td>";
echo "<td>" . $centralDBEntry['matchcount'] . "</td>";
echo "</tr>";
}
}
?>
</table>
</div>
<div id="tablecachediv" class="hiddendiv" hidden>
"We do beg your pardon, but we are in your garden"
</div>
</div>
</body>
<script src="Collapsibles.js"></script>
</html>