function getValue() { include_once(LIMB_DIR . '/core/http/Ip.class.php'); if ($this->isConstant()) return Ip :: decode($this->base->getValue()); else RaiseError('compiler', 'UNRESOLVED_BINDING'); }
function testRegister() { $stats_request = new StatsRequest(); $stats_request->setTime($time = time()); $stats_request->setAction($action = 'test'); $stats_request->setClientIp('127.0.0.1'); $referer_uri = new Uri('http://example.com'); $uri = new Uri('http://test.com'); $stats_request->setRefererUri($referer_uri); $stats_request->setUri($uri); $this->stats_referer->expectOnce('getId', array($referer_uri)); $this->stats_uri->expectOnce('getId', array($uri)); $this->stats_referer->setReturnValue('getId', $refered_id = 1); $this->stats_uri->setReturnValue('getId', $uri_id = 2); $this->register->register($stats_request); $rs =& $this->db->select('stats_hit'); $record = $rs->getRow(); $this->assertEqual($record['action'], $action); $this->assertEqual($record['time'], $time, 'log time is incorrect'); $this->assertEqual($record['session_id'], session_id()); $this->assertEqual($record['ip'], Ip::decode('127.0.0.1')); $this->assertEqual($record['stats_referer_id'], 1); $this->assertEqual($record['stats_uri_id'], $uri_id); }
function register(&$stats_request) { $stats_referer =& $this->getStatsReferer(); $stats_uri =& $this->getStatsUri(); $this->db_table->insert(array('ip' => Ip::decode($stats_request->getClientIp()), 'time' => $stats_request->getTime(), 'stats_referer_id' => $stats_referer->getId($stats_request->getRefererUri()), 'stats_uri_id' => $stats_uri->getId($stats_request->getUri()), 'session_id' => session_id(), 'action' => $stats_request->getAction())); }