Changeset 197
- Timestamp:
- 03/30/08 16:20:43 (8 months ago)
- Files:
-
- trunk/Phergie/Plugin/Dice.php (modified) (4 diffs)
- trunk/Phergie/Plugin/Eval.php (modified) (3 diffs)
- trunk/Phergie/Plugin/Sed.php (modified) (1 diff)
- trunk/Phergie/Plugin/Seen.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Plugin/Dice.php
r195 r197 125 125 $total = 0; 126 126 for($d = 0; $d < $dice; $d++) { 127 $total += mt_rand(1, $sides) + ($operator ? $bonus : ($bonus * -1));127 $total += intval(mt_rand(1, $sides) + ($operator ? $bonus : ($bonus * -1))); 128 128 } 129 129 $output[] = $total; … … 145 145 $target = $this->event->getNick(); 146 146 147 $this->doPrivmsg($source, $target . ': ' . $this->processDice($message)); 147 if ($result = $this->processDice($message)) { 148 $this->doPrivmsg($source, $target . ': ' . $result); 149 } 148 150 } 149 151 … … 158 160 $target = $this->event->getNick(); 159 161 160 $this->doPrivmsg($source, $target . ': ' . $this->processDice($message)); 162 if ($result = $this->processDice($message)) { 163 $this->doPrivmsg($source, $target . ': ' . $result); 164 } 161 165 } 162 166 … … 173 177 list($ctcp, $message) = explode(' ', $ctcp.' ', 2); 174 178 175 if ( $ctcp == 'DICE' || $ctcp == 'ROLL') {176 $this->doCtcpReply($source, $ctcp, $ this->processDice($message));179 if (($ctcp == 'DICE' || $ctcp == 'ROLL') and $result = $this->processDice($message)) { 180 $this->doCtcpReply($source, $ctcp, $result); 177 181 } 178 182 } trunk/Phergie/Plugin/Eval.php
r194 r197 29 29 // Check to see if the admin is a hostmask admin only and not an op 30 30 if ($this->fromAdmin(false)) { 31 $code = trim($code); 32 if (empty($code)) { 33 return; 34 } 31 35 32 $code = trim($code);33 36 // Check to see if the -r arg is set, if so, run the code as is, else prepend return 34 37 if (substr(strtolower($code), 0, 2) == '-r') { … … 78 81 if ($this->fromAdmin(false)) { 79 82 $code = trim($code); 83 if (empty($code)) { 84 return; 85 } 80 86 81 87 $console = false; … … 87 93 88 94 if (!empty($code)) { 89 $this->doPrivmsg($this->event->getSource(), trim(exec($code, $output))); 95 $exec = exec($code, $output); 96 if (!empty($exec)) { 97 $this->doPrivmsg($this->event->getSource(), trim($exec)); 98 unset($exec); 99 } 90 100 if (!empty($output)) { 91 101 if ($console) { trunk/Phergie/Plugin/Sed.php
r194 r197 90 90 $regex = '{^(?:([^\s:]+)\s*:?\s+)?%?s(\d*)/(.*?)(?<!\\\)/(.*?)(?:(?<!\\\)/([gimsx]*)(\d*)([gimsx]*))?$}ix'; 91 91 if (preg_match($regex, $message, $matches)) { 92 list ($match, $user, $line, $pattern, $replacement, $flags1, $limit, $flags2) = $matches; 92 list ($match, $user, $line, $pattern, $replacement, $flags1, $limit, $flags2) = array_pad($matches, 8, NULL); 93 // Temp fix for very similar but invalid Sed statements 94 if (strpos($replacement, '/') !== false and preg_match('{(?<!\\\)/}', $replacement, $m)) { 95 return; 96 } 93 97 $replacement = str_replace('\/', '/', $replacement); 94 98 $flags = str_replace('g', '', strtolower($flags1 . $flags2)); trunk/Phergie/Plugin/Seen.php
r194 r197 77 77 OR LOWER(message) LIKE LOWER(:phrase) 78 78 ORDER BY tstamp DESC 79 LIMIT :limit79 LIMIT 1,:limit 80 80 '); 81 81 … … 86 86 AND LOWER(chan) = LOWER(:chan) 87 87 ORDER BY tstamp DESC 88 LIMIT 1 88 LIMIT 1,1 89 89 '); 90 90 … … 96 96 AND LOWER(chan) = LOWER(:chan) 97 97 ORDER BY tstamp DESC 98 LIMIT 1 98 LIMIT 1,1 99 99 '); 100 100