plugins/localizer/LoggingEngine/plugins localizer.php,1.15,1.16

Sebastian Bergmann <[email protected]> Tue, 18 May 2004 06:49:55 +0000
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/plugins/localizer/LoggingEngine/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13187/localizer/LoggingEngine/plugins

Modified Files:
	localizer.php 
Log Message:
Flush.

Index: localizer.php
===================================================================
RCS file: /cvsroot/phpopencounter/plugins/localizer/LoggingEngine/plugins/localizer.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- localizer.php	20 Apr 2004 14:25:16 -0000	1.15
+++ localizer.php	18 May 2004 06:49:52 -0000	1.16
@@ -48,23 +48,18 @@
   * @access public
   */
   function post() {
-    if ($this->container['first_request']) {
-      $url = sprintf(
-        '%s?format=csv&ip=%s',
+    $this->config['plugins']['localizer']['access_method'] = isset($this->config['plugins']['localizer']['access_method']) ? $this->config['plugins']['localizer']['access_method'] : 'webservice';
 
-        $this->localizerService,
-        $this->container['ip_address']
-      );
+    if ($this->container['first_request']) {
+      if ($this->config['plugins']['localizer']['access_method'] == 'webservice') {
+        $result = $this->_queryWebservice();
+      }
 
-      if ($fp = @fopen($url, 'r')) {
-        $result = @fgetcsv($fp, 4096);
-        $result = @fgetcsv($fp, 4096);
-        @fclose($fp);
+      else if ($this->config['plugins']['localizer']['access_method'] == 'database') {
+        $result = $this->_queryDatabase();
       }
 
-      if (isset($result) &&
-          is_array($result) &&
-          sizeof($result) == 7) {
+      if ($result !== false) {
         $this->db->query(
           sprintf(
             "INSERT INTO %s
@@ -108,6 +103,35 @@
 
     return array();
   }
+
+  function _queryDatabase() {
+    return false;
+  }
+
+  function _queryWebservice() {
+    $this->config['plugins']['localizer']['service_url'] = isset($this->config['plugins']['localizer']['service_url']) ? $this->config['plugins']['localizer']['service_url'] : 'http://localhost:1025/localize/';
+
+    $url = sprintf(
+      '%s?format=csv&ip=%s',
+
+      $this->config['plugins']['localizer']['service_url'],
+      $this->container['ip_address']
+    );
+
+    if ($fp = @fopen($url, 'r')) {
+      $result = @fgetcsv($fp, 4096);
+      $result = @fgetcsv($fp, 4096);
+      @fclose($fp);
+    }
+
+    if (isset($result) &&
+        is_array($result) &&
+        sizeof($result) == 7) {
+      return $result;
+    }
+
+    return false;
+  }
 }
 
 //



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click