Author: radek.qo
Date: 2010-04-28 15:16:51 +0200 (Wed, 28 Apr 2010)
New Revision: 29297

Modified:
   
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/filter/sfWhoIsOnlineFilter.class.php
   
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/sfWhoIsOnlineUserFacade.class.php
Log:
[1.0] update filter and fix localhost problem

Modified: 
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/filter/sfWhoIsOnlineFilter.class.php
===================================================================
--- 
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/filter/sfWhoIsOnlineFilter.class.php
   2010-04-28 10:32:51 UTC (rev 29296)
+++ 
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/filter/sfWhoIsOnlineFilter.class.php
   2010-04-28 13:16:51 UTC (rev 29297)
@@ -3,7 +3,7 @@
        public function execute($filterChain)
        {
                
sfWhoIsOnlineUserFacade::registerUser($this->getContext()->getUser());
-               
+               
sfWhoIsOnlineUserTable::clearTimeouts(sfConfig::get("app_sfWhoIsOnline_timeout",60*5));
                $filterChain->execute();
        }
 }
\ No newline at end of file

Modified: 
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/sfWhoIsOnlineUserFacade.class.php
===================================================================
--- 
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/sfWhoIsOnlineUserFacade.class.php  
    2010-04-28 10:32:51 UTC (rev 29296)
+++ 
plugins/sfWhoIsOnlinePlugin/branches/1.0/lib/sfWhoIsOnlineUserFacade.class.php  
    2010-04-28 13:16:51 UTC (rev 29297)
@@ -7,37 +7,32 @@
                } else {
                        $ip = self::getIp();
                }
+  
+               $instance = sfWhoIsOnlineUserTable::getInstance()->find($ip);
+               
+               if($instance == null) {
+                       $instance = new sfWhoIsOnlineUser();
+                       $instance->ip = $ip;
+               }
 
-               //dont save session for localhost
-               if (!in_array($ip, array('127.0.0.1', '::1'))) {  
-                       $instance = 
sfWhoIsOnlineUserTable::getInstance()->find($ip);
-                       
-                       if($instance == null) {
-                               $instance = new sfWhoIsOnlineUser();
-                               $instance->ip = $ip;
-                       }
-
-                       $tags = 
get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress='.$ip);
-                       if($tags["known"] == "true") {
-                               $instance->fromTags($tags);
-                       } else {
-                               // Making an API call to Hostip:
-                       $xmlString = 
file_get_contents('http://api.hostip.info/?ip='.$ip);
-                       $xml = new SimpleXMLElement($xmlString);
-                       $instance->fromXml($xml);
-                       }
-               
-                       if(method_exists($sfUser,"getName")) {
-                               $ip = $sfUser->getName();
-                       } else {
-                               $name = $ip;
-                       }
-               $instance->name = $name;
-               
-               $instance->save();
-                       
-                       
sfWhoIsOnlineUserTable::clearTimeouts(sfConfig::get("app_sfWhoIsOnline_timeout",60*5));
+               $tags = 
get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress='.$ip);
+               if($tags["known"] == "true") {
+                       $instance->fromTags($tags);
+               } else {
+                       // Making an API call to Hostip:
+               $xmlString = 
file_get_contents('http://api.hostip.info/?ip='.$ip);
+               $xml = new SimpleXMLElement($xmlString);
+               $instance->fromXml($xml);
                }
+        
+               if(method_exists($sfUser,"getName")) {
+                       $ip = $sfUser->getName();
+               } else {
+                       $name = $ip;
+               }
+        $instance->name = $name;
+        
+        $instance->save();
        }
        private static function getIp()
        {

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to