update(['lastcall' => time()]); // if (Txodds::$_config['soccer-others'] == 'soccer') { // $lc_file = '/var/www/NuhOdds/src/Txodds/Lastcalls/flags_soccer.txt'; // $lastcall = file_get_contents($lc_file); // $url = "https://xml2.txodds.com/feed/boid_states.php?ident=betaid1&passwd=Dy59vpRC&last=$lastcall"; // } elseif (Txodds::$_config['soccer-others'] == 'others') { // $lc_file = '/var/www/NuhOdds/src/Txodds/Lastcalls/flags_other.txt'; // $lastcall = file_get_contents($lc_file); // $url = "https://xml2.txodds.com/feed/boid_states.php?ident=betaid2&passwd=Dy59vpRC&last=$lastcall"; // } // if ($lastcall < time() + 60) { // $lastcall = time() - 60; // } // if (Database::$debug == 1) { // echo Utilities::note($url); // } // $xml = Loader::xmlLoader($url); // file_put_contents($lc_file, (int) $xml['timestamp']); // $_status = []; // foreach ($xml->boid as $_boid) { // $offerid = (int) $_boid['id']; // $flags = (int) $_boid['flags']; // $_status[$offerid] = $flags; // } // $_tables = ['bai_3way', 'bai_2way', 'bai_totals', 'bai_totals_ht', 'bai_totals_qt', 'bai_points', 'bai_points_ht', 'bai_points_qt']; // foreach ($_tables as $key => $table) { // if (Txodds::$_config['soccer-others'] == 'soccer') { // $tmp = DbFunction::select($table, ['offerid', 'flags'], ['AND' => ['orig' => 0, 'sportid' => 1]]); // } elseif (Txodds::$_config['soccer-others'] == 'others') { // $tmp = DbFunction::select($table, ['offerid', 'flags'], ['AND' => ['orig' => 0, 'sportid[!]' => 1]]); // } // // foreach ($tmp as $key => $value) { // // $offerid = $value["offerid"]; // // $flags = $value["flags"]; // // if (isset($_status[$offerid])) { // // DbFunction::secureUpdate($table, ["flags"=>$flags], ["offerid"=>$offerid]); // // } // // } // foreach ($tmp as $key => $value) { // $offerid = $value['offerid']; // $old_flags = $value['flags']; // if (isset($_status[$offerid])) { // if ($_status[$offerid] == 1) { // if ($old_flags == 0) { // DbFunction::secureUpdate($table, ['flags' => 1], ['offerid' => $offerid]); // } // } else { // if ($old_flags == 1) { // DbFunction::secureUpdate($table, ['flags' => 0], ['offerid' => $offerid]); // } // } // } // } // } } }