Ejemplo n.º 1
0
 /**
  * Saving visitor information
  *
  * @param   Mage_Log_Model_Visitor $visitor
  * @return  Mage_Log_Model_Mysql4_Visitor
  */
 protected function _saveVisitorInfo($visitor)
 {
     $write = $this->_getWriteAdapter();
     $data = array('visitor_id' => $visitor->getId(), 'http_referer' => iconv_substr($visitor->getHttpReferer(), 0, 250), 'http_user_agent' => $visitor->getHttpUserAgent(), 'http_accept_charset' => $visitor->getHttpAcceptCharset(), 'http_accept_language' => $visitor->getHttpAcceptLanguage(), 'server_addr' => $visitor->getServerAddr(), 'remote_addr' => $visitor->getRemoteAddr());
     $write->insert($this->getTable('log/visitor_info'), $data);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Saving visitor information
  *
  * @param   Mage_Log_Model_Visitor $visitor
  * @return  Mage_Log_Model_Resource_Visitor
  */
 protected function _saveVisitorInfo($visitor)
 {
     /* @var $stringHelper Mage_Core_Helper_String */
     $stringHelper = Mage::helper('core/string');
     $referer = $stringHelper->cleanString($visitor->getHttpReferer());
     $referer = $stringHelper->substr($referer, 0, 255);
     $userAgent = $stringHelper->cleanString($visitor->getHttpUserAgent());
     $userAgent = $stringHelper->substr($userAgent, 0, 255);
     $charset = $stringHelper->cleanString($visitor->getHttpAcceptCharset());
     $charset = $stringHelper->substr($charset, 0, 255);
     $language = $stringHelper->cleanString($visitor->getHttpAcceptLanguage());
     $language = $stringHelper->substr($language, 0, 255);
     $adapter = $this->_getWriteAdapter();
     $data = new Varien_Object(array('visitor_id' => $visitor->getId(), 'http_referer' => $referer, 'http_user_agent' => $userAgent, 'http_accept_charset' => $charset, 'http_accept_language' => $language, 'server_addr' => $visitor->getServerAddr(), 'remote_addr' => $visitor->getRemoteAddr()));
     $bind = $this->_prepareDataForTable($data, $this->getTable('log/visitor_info'));
     $adapter->insert($this->getTable('log/visitor_info'), $bind);
     return $this;
 }