Changeset 237
- Timestamp:
- 04/14/08 22:52:27 (7 months ago)
- Files:
-
- trunk/Phergie/Plugin/Karma.php (modified) (1 diff)
- trunk/Phergie/Plugin/Lart.php (modified) (4 diffs)
- trunk/Phergie/Plugin/Spellcheck.php (modified) (1 diff)
- trunk/Phergie/Plugin/Tld.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Plugin/Karma.php
r232 r237 362 362 } 363 363 // Assertion request 364 } elseif (preg_match('#^ ([^><]+)(<|>)([^><]+)$#', $message, $m)) {364 } elseif (preg_match('#^' . $exp . '?([^><]+)(<|>)([^><]+)$#', $message, $m)) { 365 365 // Trim words 366 366 $word1 = strtolower($this->doCleanWord($m[1])); trunk/Phergie/Plugin/Lart.php
r232 r237 319 319 $message = $this->event->getArgument(1); 320 320 $target = $this->event->getNick(); 321 $nick = preg_quote($this->getIni('nick'));322 321 $hostmask = $this->event->getHostmask(); 323 322 $timenow = time(); 324 323 $today = date('md'); 324 325 // Command prefix check 326 $prefix = preg_quote(trim($this->getIni('command_prefix'))); 327 $bot = preg_quote($this->getIni('nick')); 328 $exp = '(?:(?:' . $bot . '\s*[:,>]?\s+(?:' . $prefix . ')?)|(?:' . $prefix . '))'; 325 329 326 330 if ($this->flushed != $today) { … … 331 335 332 336 $adminOnly = $this->getPluginIni('admin_only'); 333 if (preg_match('/^ (' . $nick . '\s*[:,>]?\s+)?lartinfo\s+(.*?)$/i', $message, $match)) {337 if (preg_match('/^' . $exp . 'lartinfo\s+(.*?)$/i', $message, $match)) { 334 338 if ($this->fromAdmin()) { 335 list(, $address, $name) = array_pad($match, 3, null); 336 $name = trim($name); 339 $name = trim($match[1]); 337 340 if (!empty($name)) { 338 341 $this->select->execute(array(':name' => $name)); … … 358 361 $this->doNotice($target, 'You do not have permission to view the lart info.'); 359 362 } 360 } else if (preg_match('/^(' . $ nick. '\s*[:,>]?\s+)?(.*?)\s+is\s+(.*)$/i', $message, $match)) {363 } else if (preg_match('/^(' . $bot . '\s*[:,>]?\s+)?(.*?)\s+is\s+(.*)$/i', $message, $match)) { 361 364 list(, $address, $name, $definition) = array_pad($match, 4, null); 362 365 if (!empty($name) && !empty($definition) && (empty($address) xor $source[0] == '#')) { … … 375 378 } 376 379 } 377 } else if (preg_match('/^ (' . $nick . '\s*[:,>]?\s+)?forget\s+(.*)$/i', $message, $match)) {380 } else if (preg_match('/^' . $exp . 'forget\s+(.*)$/i', $message, $match)) { 378 381 if (!$adminOnly || $this->fromAdmin()) { 379 382 list(, $address, $name) = array_pad($match, 3, null); trunk/Phergie/Plugin/Spellcheck.php
r232 r237 66 66 $target = $this->event->getNick(); 67 67 68 if (preg_match('#(\S+)\s*\(sp\??\)#i', $message, $m)) { 69 $word = $m[1]; 68 // Command prefix check 69 $prefix = preg_quote(trim($this->getIni('command_prefix'))); 70 $bot = preg_quote($this->getIni('nick')); 71 $exp = '(?:(?:' . $bot . '\s*[:,>]?\s+(?:' . $prefix . ')?)|(?:' . $prefix . '))'; 72 73 if (preg_match('#(?:^' . $exp . 'spell(?:check)?\s+(\S+)|(\S+)\s*\(sp\??\))#i', $message, $m)) { 74 $word = (!empty($m[1]) ? $m[1] : $m[2]); 70 75 if (!pspell_check($this->pspell, $word)) { 71 76 $suggestions = pspell_suggest($this->pspell, $word); trunk/Phergie/Plugin/Tld.php
r232 r237 186 186 187 187 $target = $this->event->getNick(); 188 189 // Command prefix check 188 190 $prefix = preg_quote(trim($this->getIni('command_prefix'))); 189 if (preg_match('#^(?:' . preg_quote($this->getIni('nick')) . '\s*[:,>]?\s+)?(?:' . $prefix . 'tld\s+\.?([a-z]{2,10})|\.([a-z]{2,10}))$#i', $this->event->getArgument(1), $m) && 191 $bot = preg_quote($this->getIni('nick')); 192 $exp = '(?:(?:' . $bot . '\s*[:,>]?\s+(?:' . $prefix . ')?)|(?:' . $prefix . '))'; 193 194 if (preg_match('#^(?:' . $exp . 'tld\s+\.?([a-z]{2,10})$|' . $exp . '?\.([a-z]{2,10}))$#i', $this->event->getArgument(1), $m) && 190 195 $description = self::getTld((!empty($m[1]) ? $m[1] : $m[2]))) { 191 196 $this->doPrivmsg($this->event->getSource(),