]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge in Phergie fixes and remove some whitespace
authorLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Tue, 27 Jul 2010 16:14:07 +0000 (09:14 -0700)
committerLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Tue, 27 Jul 2010 16:14:07 +0000 (09:14 -0700)
plugins/Irc/extlib/phergie/Phergie/Driver/Streams.php
plugins/Irc/extlib/phergie/Phergie/Plugin/Cookie/db.php
plugins/Irc/extlib/phergie/Phergie/Plugin/Tld/db.php
plugins/Irc/ircmanager.php

index 9f9e2585d2d7ff1f7bda8b90734b377f072a6fa1..ed64bba2ac615839d75ed03b538228fa7c77bba8 100755 (executable)
@@ -219,6 +219,14 @@ class Phergie_Driver_Streams extends Phergie_Driver_Abstract
      */
     public function getEvent()
     {
+        // Check the socket is still active
+        if (feof($this->socket)) {
+            throw new Phergie_Driver_Exception(
+                'EOF detected on socket',
+                Phergie_Driver_Exception::ERR_CONNECTION_READ_FAILED
+            );
+        }
+
         // Check for a new event on the current connection
         $buffer = fgets($this->socket, 512);
         if ($buffer === false) {
index 4b3d29c53ef7a2dd7cb3e1afd49f87a5bd1d9005..91d375ca6d714bd6f14eecf96345e2fe5f089775 100644 (file)
@@ -35,15 +35,24 @@ $xpath = new DOMXPath($doc);
 $cookies = $xpath->query('//table[@width="90%"]/tr/td[1]/a');
 
 foreach ($cookies as $cookie) {
-    
-    $name = str_replace(array('(',')',"\n", 'cookies'), array('','', ' ', 'cookie' ), trim( $cookie->textContent));
+    $name = $cookie->textContent;
+    foreach (range(0, mb_strlen($name) - 1) as $index) {
+        echo mb_strcut($name, $index, 1), PHP_EOL;
+    }
+    $name = str_replace(
+        array('(',')',"\n", 'cookies'),
+        array('','', ' ', 'cookie'),
+        $name
+    );
+    $name = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $name);
+    $name = trim($name);
+    $name = rtrim($name, 's');
 
     $link =  'http://en.wikipedia.org' . $cookie->getAttribute('href');
     $insert->execute(array($name, $link));
-    print 'added ['.$name.'] -> '. $link . PHP_EOL;
+    echo 'added [' . $name . '] -> '. $link . PHP_EOL;
 }
 
 // Clean up
 echo 'Cleaning up', PHP_EOL;
 unlink($file);
-
index 28f963ad108b859cda1911ab57744c2224516c4d..364d9a09f86b340b0610cf1e5fd135d92105840f 100644 (file)
Binary files a/plugins/Irc/extlib/phergie/Phergie/Plugin/Tld/db.php and b/plugins/Irc/extlib/phergie/Phergie/Plugin/Tld/db.php differ
index 8042ae24c2633a079812f1c4c14cbbefcfd099d8..a54db566a9817bed70c483a28fae02fb408a83cf 100644 (file)
@@ -64,8 +64,6 @@ class IrcManager extends ImManager {
         }
     }
 
-
-
     /**
      * Idle processing for io manager's execution loop.
      * Send keepalive pings to server.