コード例 #1
0
ファイル: Plugin_Versus.php プロジェクト: Laxa/Nimda3
 function isTriggered()
 {
     if (!isset($this->data['text'])) {
         $this->printUsage();
         return;
     }
     $input = explode(',', $this->data['text']);
     if (empty($input[1])) {
         $this->reply(sprintf($this->usage, $this->data['trigger']));
         return;
     }
     $terms = array();
     for ($i = 0; $i < 2; $i++) {
         $terms[$i] = trim($input[$i]);
         if (str_word_count($terms[$i]) == 1) {
             $terms[$i] = '"' . $terms[$i] . '"';
         }
     }
     $word1Hits = libInternet::googleResults($terms[0]);
     $word2Hits = libInternet::googleResults($terms[1]);
     if ($word1Hits + $word2Hits == 0) {
         $zero = array('zero', 'oh', 'null', 'nil', 'nought');
         $this->reply('I can\'t compare ' . $zero[rand(0, 4)] . ' with ' . $zero[rand(0, 4)] . '.');
         return;
     }
     $this->reply('(' . number_format($word1Hits, 0, ',', '.') . ") " . $input[0] . " " . $this->getBar($word1Hits, $word2Hits) . " " . $input[1] . " (" . number_format($word2Hits, 0, ',', '.') . ")");
 }
コード例 #2
0
ファイル: Plugin_Google.php プロジェクト: Laxa/Nimda3
 function isTriggered()
 {
     if (!isset($this->data['text'])) {
         $this->printUsage();
         return;
     }
     $this->reply(sprintf('%s (Results: %s)', "http://www.google.com/search?q=" . urlencode($this->data['text']) . "&hl=" . $this->getConfig('language') . "&safe=off", number_format(libInternet::googleResults($this->data['text']), 0, ',', '.')));
 }
コード例 #3
0
ファイル: Google.php プロジェクト: noother/Nimda2
 function isTriggered()
 {
     if (!isset($this->info['text'])) {
         $this->sendOutput(sprintf($this->CONFIG['no_term'], $this->info['triggerUsed']));
         return;
     }
     $link = "http://www.google.com/search?q=" . urlencode($this->info['text']) . "&hl=" . $this->CONFIG['lang'] . "&safe=off";
     $results = number_format(libInternet::googleResults($this->info['text']), 0, ',', '.');
     $output = $link . " (Results: ";
     if (!$results) {
         $output .= "0";
     } else {
         $output .= "~ ";
     }
     $output .= $results . ")";
     $this->sendOutput($output);
 }
コード例 #4
0
ファイル: Vs.php プロジェクト: noother/Nimda2
 function isTriggered()
 {
     if (!isset($this->info['text'])) {
         $this->sendOutput(sprintf($this->CONFIG['no_term'], $this->info['triggerUsed']));
         return;
     }
     $input = explode(",", $this->info['text']);
     if ($input[1] == "") {
         $this->sendOutput(sprintf($this->CONFIG['no_term'], $this->info['triggerUsed']));
         return;
     }
     $word1Hits = libInternet::googleResults($input[0]);
     $word2Hits = libInternet::googleResults($input[1]);
     if ($word1Hits + $word2Hits == 0) {
         $zero = array("zero", "oh", "null", "nil", "nought");
         $this->sendOutput("I can't compare " . $zero[rand(0, 4)] . " with " . $zero[rand(0, 4)] . ".");
         return;
     }
     $this->sendOutput("(" . number_format($word1Hits, 0, ',', '.') . ") " . $input[0] . " " . $this->getBar($word1Hits, $word2Hits) . " " . $input[1] . " (" . number_format($word2Hits, 0, ',', '.') . ")");
 }
コード例 #5
0
ファイル: Hangman.php プロジェクト: noother/Nimda2
 function addWord($word)
 {
     $old_word = $word;
     $word = libString::convertUmlaute($word);
     $word = libString::capitalize($word);
     if (preg_match("/[^a-zA-Z]/", $word)) {
         $this->sendOutput("Your word must contain only letters.");
         return;
     }
     $sql = "SELECT id FROM hangman WHERE word='" . addslashes($word) . "'";
     $res = $this->MySQL->sendQuery($sql);
     if ($res['count'] != 0) {
         $this->sendOutput("This word is already in the database.");
         return;
     }
     $google_results = libInternet::googleResults($old_word);
     if ($google_results < $this->CONFIG['google_min']) {
         //$output = sprintf($this->CONFIG['googlemin_text'],
         //					$this->CONFIG['google_min']
         //				 );
         $this->sendOutput($this->CONFIG['googlemin_text']);
         return;
     }
     $blacklist = array("add", "del", "stats", "start", "stop");
     if (array_search(strtolower($word), $blacklist) !== false) {
         $this->sendOutput("Stuuuuupiiid!");
         return;
     }
     $sql = "INSERT INTO\n\t\t\t\t\thangman\n\t\t\t\t\t(word, author, created)\n\t\t\t\tVALUES (\n\t\t\t\t\t'" . addslashes($word) . "',\n\t\t\t\t\t'" . addslashes($this->info['nick']) . "',\n\t\t\t\t\tNOW()\n\t\t\t\t)";
     $this->MySQL->sendQuery($sql);
     $this->sendOutput("Word '" . $word . "' has been added to the database.");
     return;
 }