Ignore:
Timestamp:
Aug 10, 2008, 10:45:34 AM (16 years ago)
Author:
george
Message:
  • Opraveno: IRC bot pro sledování historie nyní správně načítá dvojtečky a zpětná lomítka.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/www/chat/irc_bot.php

    r98 r105  
    2525    $this->Command('NICK '.$this->Nick);
    2626    //sleep($JoinWaitTime);
    27     $this->Command('JOIN '.$Channel);
     27    $this->Command('JOIN '.$this->Channel);
    2828  }
    2929
     
    7171      }
    7272
     73      $Commands = array(substr($Line, 0, strpos($Line, ':') + 1));
     74      $Line = substr($Line, strlen($Commands[0]));
     75      $Commands[1] = substr($Line, 0, strpos($Line, ':') + 1);
     76      $Commands[2] = substr($Line, strlen($Commands[1]));     
     77      //print_r($Commands);
     78
    7379      // Log messages to database
    7480      if(strpos($Line, 'PRIVMSG') !== false)
    7581      {
    76         $LineParts = explode(':', $Line);
    77         $Text = $LineParts[2];
    78         $LineParts2 = explode(' ', $LineParts[1]);
     82        $Text = addslashes($Commands[2]);
     83        $LineParts2 = explode(' ', $Commands[1]);
    7984        $LineParts3 = explode('@', $LineParts2[0]);
    80         $Host = $LineParts3[1];
     85        $Host = addslashes($LineParts3[1]);
    8186        $LineParts4 = explode('!', $LineParts3[0]);
    82         $Nick = $LineParts4[0];
     87        $Nick = addslashes($LineParts4[0]);
    8388        $Database->insert('ChatHistory', array('Nick' => $Nick, 'Text' => $Text, 'Host' => $Host, 'Time' => 'NOW()', 'RoomName' => 'Všichni'));
    8489      }
    8590
    86       $Commands = explode(':', $Line);
     91     
     92      explode(':', $Line);
    8793      foreach($Commands as $Index => $Item)
    8894        $Commands[$Index] = trim($Item);
Note: See TracChangeset for help on using the changeset viewer.