Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/blogvaul.../callback/wings
File: watch.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (!defined('ABSPATH')) exit;
[2] Fix | Delete
if (!class_exists('BVWatchCallback')) :
[3] Fix | Delete
[4] Fix | Delete
class BVWatchCallback extends BVCallbackBase {
[5] Fix | Delete
public $db;
[6] Fix | Delete
public $settings;
[7] Fix | Delete
[8] Fix | Delete
const WATCH_WING_VERSION = 1.4;
[9] Fix | Delete
[10] Fix | Delete
public function __construct($callback_handler) {
[11] Fix | Delete
$this->db = $callback_handler->db;
[12] Fix | Delete
$this->settings = $callback_handler->settings;
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
public function getData($table, $limit = 0, $filter = "") {
[16] Fix | Delete
$result = array();
[17] Fix | Delete
$data = array();
[18] Fix | Delete
$rows = $this->db->getTableContent($table, '*', $filter, $limit);
[19] Fix | Delete
$last_id = 0;
[20] Fix | Delete
foreach ($rows as $row) {
[21] Fix | Delete
$result[] = $row;
[22] Fix | Delete
$last_id = $row['id'];
[23] Fix | Delete
}
[24] Fix | Delete
$data['last_id'] = $last_id;
[25] Fix | Delete
$data['rows'] = $result;
[26] Fix | Delete
return $data;
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
public function deleteBvDynamicEvents($filter = "") {
[30] Fix | Delete
$name = BVWPDynSync::$dynsync_table;
[31] Fix | Delete
return $this->db->deleteBVTableContent($name, $filter);
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
public function setWatchTime() {
[35] Fix | Delete
return $this->settings->updateOption('bvwatchtime', time());
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
public function getFWPrependLog($params) {
[39] Fix | Delete
$result = array();
[40] Fix | Delete
$fname = $params['fname'];
[41] Fix | Delete
$limit = intval($params['limit']);
[42] Fix | Delete
[43] Fix | Delete
if (file_exists($fname)) {
[44] Fix | Delete
[45] Fix | Delete
$result['exists'] = true;
[46] Fix | Delete
$tmpfname = $fname."tmp";
[47] Fix | Delete
[48] Fix | Delete
if (!@rename($fname, $tmpfname)) {
[49] Fix | Delete
[50] Fix | Delete
$result = array('status' => 'Error', 'message' => 'UNABLE_TO_RENAME_LOGFILE');
[51] Fix | Delete
[52] Fix | Delete
} else {
[53] Fix | Delete
[54] Fix | Delete
if (file_exists($tmpfname)) {
[55] Fix | Delete
[56] Fix | Delete
$fsize = filesize($tmpfname);
[57] Fix | Delete
$result["size"] = $fsize;
[58] Fix | Delete
[59] Fix | Delete
if ($fsize <= $limit) {
[60] Fix | Delete
[61] Fix | Delete
$result['content'] = file_get_contents($tmpfname);
[62] Fix | Delete
[63] Fix | Delete
} else {
[64] Fix | Delete
$handle = fopen($tmpfname, "rb");
[65] Fix | Delete
$result['content'] = fread($handle, $limit);
[66] Fix | Delete
$result['incomplete'] = true;
[67] Fix | Delete
fclose($handle);
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$result['tmpfile'] = unlink($tmpfname);
[71] Fix | Delete
} else {
[72] Fix | Delete
$result['tmpfile'] = 'DOES_NOT_EXISTS';
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
}
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
return $result;
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
public function getDomainInfo($params) {
[82] Fix | Delete
$domain = $params["domain"];
[83] Fix | Delete
if (empty($domain)) {
[84] Fix | Delete
return array('domainData' => "DOMAIN_NOT_PRESENT");
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
$whoisServer = $params["host"];
[88] Fix | Delete
if (empty($whoisServer)) {
[89] Fix | Delete
return array('domainData' => "WHOIS_SERVER_NOT_PRESENT : $domain");
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
$conn = @fsockopen($whoisServer, $params["port"], $errno, $errstr, $params["timeout"]);
[93] Fix | Delete
if (!$conn) {
[94] Fix | Delete
return array('domainData' => "UNABLE_TO_CONNECT_TO_WHOIS_SERVER : $whoisServer : DOMAIN : $domain : ERROR : $errstr ($errno)");
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
try {
[98] Fix | Delete
fwrite($conn, "$domain\r\n");
[99] Fix | Delete
[100] Fix | Delete
$response = '';
[101] Fix | Delete
while (!feof($conn)) {
[102] Fix | Delete
$response .= fgets($conn, 1024);
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
fclose($conn);
[106] Fix | Delete
} catch (Exception $e) {
[107] Fix | Delete
fclose($conn);
[108] Fix | Delete
return array('domainData' => "ERROR_WHILE_FETCHING_DATA : " . $e->getMessage());
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
return array('domainData' => $response);
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
public function process($request) {
[115] Fix | Delete
$db = $this->db;
[116] Fix | Delete
$settings = $this->settings;
[117] Fix | Delete
$this->setWatchTime();
[118] Fix | Delete
$params = $request->params;
[119] Fix | Delete
[120] Fix | Delete
switch ($request->method) {
[121] Fix | Delete
case "getdata":
[122] Fix | Delete
$resp = array();
[123] Fix | Delete
[124] Fix | Delete
if (isset($params['domain_params']) && is_array($params['domain_params'])) {
[125] Fix | Delete
$resp = array_merge($resp, $this->getDomainInfo($params['domain_params']));
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
if (array_key_exists('lp', $params)) {
[129] Fix | Delete
require_once dirname( __FILE__ ) . '/../../protect/lp.php';
[130] Fix | Delete
$lp_params = $params['lp'];
[131] Fix | Delete
if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVProtectLP_V565::TABLE_NAME))) {
[132] Fix | Delete
$limit = intval($lp_params['limit']);
[133] Fix | Delete
$filter = $lp_params['filter'];
[134] Fix | Delete
$db->deleteBVTableContent(BVProtectLP_V565::TABLE_NAME, $lp_params['rmfilter']);
[135] Fix | Delete
$table = $db->getBVTable(BVProtectLP_V565::TABLE_NAME);
[136] Fix | Delete
$resp["lplogs"] = $this->getData($table, $limit, $filter);
[137] Fix | Delete
} else {
[138] Fix | Delete
$resp["lplogs"] = array("status" => "TABLE_NOT_PRESENT");
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
if (array_key_exists('prelog', $params)) {
[143] Fix | Delete
$prelog_params = $params['prelog'];
[144] Fix | Delete
$resp["prelog"] = $this->getFWPrependLog($prelog_params);
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
if (array_key_exists('fw', $params)) {
[148] Fix | Delete
require_once dirname( __FILE__ ) . '/../../protect/fw.php';
[149] Fix | Delete
$fw_params = $params['fw'];
[150] Fix | Delete
if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVProtectFW_V565::TABLE_NAME))) {
[151] Fix | Delete
$limit = intval($fw_params['limit']);
[152] Fix | Delete
$filter = $fw_params['filter'];
[153] Fix | Delete
$db->deleteBVTableContent(BVProtectFW_V565::TABLE_NAME, $fw_params['rmfilter']);
[154] Fix | Delete
$table = $db->getBVTable(BVProtectFW_V565::TABLE_NAME);
[155] Fix | Delete
$resp["fwlogs"] = $this->getData($table, $limit, $filter);
[156] Fix | Delete
} else {
[157] Fix | Delete
$resp["fwlogs"] = array("status" => "TABLE_NOT_PRESENT");
[158] Fix | Delete
}
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if (array_key_exists('dynevent', $params)) {
[162] Fix | Delete
require_once dirname( __FILE__ ) . '/../../wp_dynsync.php';
[163] Fix | Delete
$isdynsyncactive = $settings->getOption('bvDynSyncActive');
[164] Fix | Delete
if ($isdynsyncactive == 'yes') {
[165] Fix | Delete
if (!isset($params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVWPDynSync::$dynsync_table))) {
[166] Fix | Delete
$limit = intval($params['limit']);
[167] Fix | Delete
$filter = $params['filter'];
[168] Fix | Delete
$this->deleteBvDynamicEvents($params['rmfilter']);
[169] Fix | Delete
$table = $db->getBVTable(BVWPDynSync::$dynsync_table);
[170] Fix | Delete
$data = $this->getData($table, $limit, $filter);
[171] Fix | Delete
$resp['last_id'] = $data['last_id'];
[172] Fix | Delete
$resp['events'] = $data['rows'];
[173] Fix | Delete
$resp['timestamp'] = time();
[174] Fix | Delete
$resp["status"] = true;
[175] Fix | Delete
}
[176] Fix | Delete
}
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
if (array_key_exists('actlog', $params)) {
[180] Fix | Delete
require_once dirname( __FILE__ ) . '/../../wp_actlog.php';
[181] Fix | Delete
$actlog_params = $params['actlog'];
[182] Fix | Delete
if (!isset($actlog_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVWPActLog::$actlog_table))) {
[183] Fix | Delete
$limit = intval($actlog_params['limit']);
[184] Fix | Delete
$filter = $actlog_params['filter'];
[185] Fix | Delete
$db->deleteBVTableContent(BVWPActLog::$actlog_table, $actlog_params['rmfilter']);
[186] Fix | Delete
$table = $db->getBVTable(BVWPActLog::$actlog_table);
[187] Fix | Delete
$resp["actlogs"] = $this->getData($table, $limit, $filter);
[188] Fix | Delete
} else {
[189] Fix | Delete
$resp["actlogs"] = array("status" => "TABLE_NOT_PRESENT");
[190] Fix | Delete
}
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
if (array_key_exists('airlift_stats', $params)) {
[194] Fix | Delete
$airlift_stats_table = "airlift_stats";
[195] Fix | Delete
$airlift_stats_params = $params['airlift_stats'];
[196] Fix | Delete
$table = $db->getBVTable($airlift_stats_table);
[197] Fix | Delete
if (!isset($airlift_stats_params['bv_check_table']) || $db->isTablePresent($table)) {
[198] Fix | Delete
$limit = intval($airlift_stats_params['limit']);
[199] Fix | Delete
$filter = $airlift_stats_params['filter'];
[200] Fix | Delete
$db->deleteBVTableContent($airlift_stats_table, $airlift_stats_params['rmfilter']);
[201] Fix | Delete
$resp["airlift_stats"] = $this->getData($table, $limit, $filter);
[202] Fix | Delete
} else {
[203] Fix | Delete
$resp["airlift_stats"] = array("status" => "TABLE_NOT_PRESENT");
[204] Fix | Delete
}
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
if (array_key_exists('php_error_monitoring', $params)) {
[208] Fix | Delete
require_once dirname( __FILE__ ) . '/../../php_error_monitoring/monitoring.php';
[209] Fix | Delete
$php_error_monit_params = $params['php_error_monitoring'];
[210] Fix | Delete
$table = $db->getBVTable(BVWPPHPErrorMonitoring::ERROR_TABLE);
[211] Fix | Delete
if (!isset($php_error_monit_params['bv_check_table']) || $db->isTablePresent($table)) {
[212] Fix | Delete
$limit = intval($php_error_monit_params['limit']);
[213] Fix | Delete
$filter = $php_error_monit_params['filter'];
[214] Fix | Delete
$db->deleteBVTableContent(BVWPPHPErrorMonitoring::ERROR_TABLE, $php_error_monit_params['rmfilter']);
[215] Fix | Delete
$resp["php_error_monitoring"] = $this->getData($table, $limit, $filter);
[216] Fix | Delete
} else {
[217] Fix | Delete
$resp["php_error_monitoring"] = array("status" => "TABLE_NOT_PRESENT");
[218] Fix | Delete
}
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
$resp["status"] = "done";
[222] Fix | Delete
break;
[223] Fix | Delete
case "rmdata":
[224] Fix | Delete
require_once dirname( __FILE__ ) . '/../../wp_dynsync.php';
[225] Fix | Delete
$filter = $params['filter'];
[226] Fix | Delete
$resp = array("status" => $this->deleteBvDynamicEvents($filter));
[227] Fix | Delete
break;
[228] Fix | Delete
default:
[229] Fix | Delete
$resp = false;
[230] Fix | Delete
}
[231] Fix | Delete
return $resp;
[232] Fix | Delete
}
[233] Fix | Delete
}
[234] Fix | Delete
endif;
[235] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function