private function FirewallUpdater::addDataUaBlTable in Anti Spam by CleanTalk 8.4
Same name and namespace in other branches
- 9.1.x src/lib/Cleantalk/Common/Firewall/FirewallUpdater.php \Cleantalk\Common\Firewall\FirewallUpdater::addDataUaBlTable()
Add data to table for AntiCrawler Table is determined by a constant APBCT_TBL_AC_UA_BL
1 call to FirewallUpdater::addDataUaBlTable()
- FirewallUpdater::update in src/
lib/ Cleantalk/ Common/ Firewall/ FirewallUpdater.php
File
- src/
lib/ Cleantalk/ Common/ Firewall/ FirewallUpdater.php, line 412
Class
Namespace
Cleantalk\Common\FirewallCode
private function addDataUaBlTable($lines) {
# table ub bl name
$ua_bl_table_name = $this->db->prefix . APBCT_TBL_AC_UA_BL;
# Drop table APBCT_TBL_AC_UA_BL
if (!empty($lines)) {
$this->db
->execute('DELETE FROM `' . $ua_bl_table_name . '`');
}
reset($lines);
for ($count_result = 0; current($lines) !== false;) {
$query = "INSERT INTO `" . $ua_bl_table_name . "` (`id`, `ua_template`, `ua_status`) VALUES ";
for ($i = 0, $values = array(); self::WRITE_LIMIT !== $i && current($lines) !== false; $i++, $count_result++, next($lines)) {
$entry = current($lines);
if (empty($entry)) {
continue;
}
if (self::WRITE_LIMIT !== $i) {
$id = isset($entry[0]) ? $entry[0] : 0;
$ua_template = isset($entry[1]) ? str_replace('"', '\'', $entry[1]) : 0;
$ua_status = isset($entry[2]) ? $entry[2] : 0;
}
$values[] = '(' . $id . ',' . $ua_template . ',' . $ua_status . ')';
}
if (!empty($values)) {
$query = $query . implode(',', $values) . ';';
$this->db
->execute($query);
}
}
}