v7‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT getDi()->sqlDateTime; return parent::insert($values, $returnInserted); } function log(User $aff, AffBanner $banner = null, $referrer = null, $keyword_id = null) { $this->_db->query("INSERT INTO ?_aff_click SET aff_id=?d, time=?, banner_id=?d, remote_addr=?, referer=?, keyword_id = ? ", $aff->pk(), $this->getDi()->sqlDateTime, $banner ? $banner->pk() : null, $_SERVER['REMOTE_ADDR'], ($referrer ? $referrer : @$_SERVER['HTTP_REFERER']), $keyword_id ); return $this->_db->selectCell("SELECT LAST_INSERT_ID()"); } function fetchByDate($date, $aff_id=null) { return $this->selectObjects( "SELECT * FROM ?_aff_click WHERE time BETWEEN ? AND ? { AND aff_id=?d}", date('Y-m-d 00:00:00', amstrtotime($date)), date('Y-m-d 23:59:59', amstrtotime($date)), $aff_id === null ? DBSIMPLE_SKIP : $aff_id); } function fetchByDateInterval($from, $to, $aff_id=null) { return $this->selectObjects( "SELECT * FROM ?_aff_click WHERE time BETWEEN ? AND ? { AND aff_id=?d}", date('Y-m-d 00:00:00', amstrtotime($from)), date('Y-m-d 23:59:59', amstrtotime($to)), $aff_id === null ? DBSIMPLE_SKIP : $aff_id); } /** * Find affililate by IP address if cookie is empty * @param type $ip * @return last aff_id in record with matching IP */ function findAffIdByIp($ip) { $startTm = sqlTime($this->getDi()->time - $this->getDi()->config->get('aff.cookie_lifetime', 365) * 24 * 3600); return $this->_db->selectCell("SELECT CONCAT(aff_id, '-', IFNULL(banner_id, '')) FROM $this->_table WHERE time >= ? AND remote_addr=? AND aff_id>0 ORDER BY time DESC LIMIT 1", $startTm, $ip); } function clearOld($date) { $this->_db->query("DELETE FROM ?_aff_click WHERE time < ?", $date); } }