Changeset 78
- Timestamp:
- 02/26/08 03:47:02 (9 months ago)
- Files:
-
- trunk/Phergie/Bot.php (modified) (5 diffs)
- trunk/Phergie/Plugin/Abstract/AdminCommand.php (modified) (1 diff)
- trunk/Phergie/Plugin/Abstract/Base.php (modified) (5 diffs)
- trunk/Phergie/Plugin/Acronym.php (modified) (2 diffs)
- trunk/Phergie/Plugin/Drink.php (modified) (1 diff)
- trunk/Phergie/Plugin/Karma.php (modified) (2 diffs)
- trunk/Phergie/Plugin/Lart.php (modified) (3 diffs)
- trunk/Phergie/Plugin/Logging.php (modified) (6 diffs)
- trunk/Phergie/Plugin/Nickserv.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Bot.php
r71 r78 67 67 $ini = PHERGIE_INI; 68 68 } else { 69 echo 'Loaded specified configuration file ' . $argv[1] . "\n"; 69 70 $ini = $argv[1]; 70 71 } … … 88 89 } 89 90 91 unset ($required); 92 90 93 /** 91 94 * Configure the client … … 104 107 } 105 108 109 unset ($setting, $value, $driver, $class); 110 106 111 /** 107 112 * Determine which plugins should be loaded … … 117 122 } 118 123 119 /** 120 * Remove temporary global configuration variables from memory 121 */ 122 unset($required, $config, $setting, $driver, $class); 124 unset ($config); 123 125 124 126 /** … … 126 128 */ 127 129 $iterator = new DirectoryIterator(PHERGIE_DIR . '/Phergie/Plugin'); 130 $plugins = array(); 128 131 foreach ($iterator as $entry) { 129 if ($iterator->isFile() 130 && substr($entry, -4) == '.php' 131 && ($all xor in_array(strtolower(substr($entry, 0, -4)), $include))) { 132 require_once 'Phergie/Plugin/' . $entry; 133 $class = 'Phergie_Plugin_' . str_replace('.php', '', $entry); 132 if ($iterator->isFile()) { 133 $name = substr($entry, 0, -4); 134 if ($all xor in_array(strtolower($name), $include)) { 135 $plugins[] = $name; 136 } 137 } 138 } 139 sort($plugins); 140 141 unset ($iterator, $entry, $name, $all, $include); 142 143 foreach ($plugins as $plugin) { 144 require_once 'Phergie/Plugin/' . $plugin . '.php'; 145 $class = 'Phergie_Plugin_' . $plugin; 146 if (call_user_func(array($class, 'checkDependencies'), $plugins)) { 134 147 $instance = new $class($client); 135 148 $client->addPlugin($instance); 136 $client->debug('Loaded ' . $instance->getName()); 149 $client->debug('Loaded ' . $plugin); 150 } else { 151 $client->debug('Unable to load ' . $plugin); 137 152 } 138 153 } 139 154 140 /** 141 * Remove temporary plugin configuration variables from memory 142 */ 143 unset($iterator, $class, $entry, $all, $exclude, $reflector); 155 unset ($plugins, $plugin, $class, $instance); 144 156 145 157 /** trunk/Phergie/Plugin/Abstract/AdminCommand.php
r71 r78 108 108 109 109 /** 110 * Returns whether or not the plugin's dependencies are met. 111 * 112 * @param array $plugins List of short names for plugins that the 113 * bootstrap file intends to instantiate 114 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 115 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 116 * @return bool TRUE if dependencies are met, FALSE otherwise 117 */ 118 public static function checkDependencies(array $plugins) 119 { 120 if (! in_array('Users', $plugins) 121 || ! Phergie_Plugin_Users::checkDependencies($plugins)) { 122 return false; 123 } 124 125 return true; 126 } 127 128 /** 110 129 * Returns whether or not a message originated from an authorized admin or 111 130 * op. trunk/Phergie/Plugin/Abstract/Base.php
r71 r78 32 32 33 33 /** 34 * Path to the directory for the plugin if needsDir is enabled34 * Path to the directory for the plugin if $needsDir is enabled 35 35 * 36 36 * @see $needsDir … … 39 39 40 40 /** 41 * Reference back to the client used to initiate commands41 * Reference back to the client, used to initiate commands 42 42 * 43 43 * @var Phergie_Driver_Abstract … … 46 46 47 47 /** 48 * Reference to the current instance of the plugin, used to make its 49 * non-static methods accessible to other plugins 50 * 51 * @var Phergie_Plugin_Abstract_Base 52 */ 53 protected static $instance; 54 55 /** 48 56 * Short class name 49 57 * … … 67 75 final public function __construct(Phergie_Driver_Abstract $client) 68 76 { 77 self::$instance = $this; 78 69 79 $this->client = $client; 70 80 … … 191 201 192 202 /** 203 * Returns a reference to the instance of the current plugin. 204 * 205 * @return Phergie_Plugin_Abstract_Base 206 */ 207 public static function getInstance() 208 { 209 return self::$instance; 210 } 211 212 /** 213 * Returns whether or not the current environment meets the requirements 214 * of the plugin in order for it to be run, including the PHP version, 215 * loaded PHP extensions, and other plugins intended to be loaded. 216 * Plugins with such requirements should override this method. 217 * 218 * @param array $plugins List of short names for plugins that the 219 * bootstrap file intends to instantiate 220 * @return bool TRUE if dependencies are met, FALSE otherwise 221 */ 222 public static function checkDependencies(array $plugins) 223 { 224 return true; 225 } 226 227 /** 193 228 * Initializes the plugin. Should it require initialization, just 194 229 * override this method. trunk/Phergie/Plugin/Acronym.php
r72 r78 5 5 */ 6 6 require_once 'Phergie/Plugin/Abstract/Base.php'; 7 8 /** 9 * @see Phergie_Plugin_Users 10 */ 11 require_once 'Phergie/Plugin/Users.php'; 7 12 8 13 /** … … 63 68 64 69 $this->filter = array_filter(preg_split('/[ ,]/', $this->getPluginIni('filter')), 'strlen'); 70 } 71 72 /** 73 * Returns whether or not the plugin's dependencies are met. 74 * 75 * @param array $plugins List of short names for plugins that the 76 * bootstrap file intends to instantiate 77 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 78 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 79 * @return bool TRUE if dependencies are met, FALSE otherwise 80 */ 81 public static function checkDependencies(array $plugins) 82 { 83 if (! in_array('Users', $plugins) 84 || ! Phergie_Plugin_Users::checkDependencies($plugins)) { 85 return false; 86 } 87 88 return true; 65 89 } 66 90 trunk/Phergie/Plugin/Drink.php
r61 r78 89 89 public function init() 90 90 { 91 // Check for the necessary extensions 92 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 93 return; 94 } 95 96 // Initialize the database connection 97 $this->db = new PDO('sqlite:' . $this->dir . 'drink.db'); 98 99 // Populate the database if necessary 100 if ($this->needTable('beer')) { 101 $contents = @file_get_contents('http://beerme.com/beerlist.php'); 102 if ($contents !== false) { 103 preg_match_all('/brewery\.php\?[0-9]+#[0-9]+\'>([^<]+)/', $contents, $matches); 91 try { 92 // Initialize the database connection 93 $this->db = new PDO('sqlite:' . $this->dir . 'drink.db'); 94 95 // Populate the database if necessary 96 if ($this->needTable('beer')) { 97 $contents = @file_get_contents('http://beerme.com/beerlist.php'); 98 if ($contents !== false) { 99 preg_match_all('/brewery\.php\?[0-9]+#[0-9]+\'>([^<]+)/', $contents, $matches); 100 $names = array(); 101 foreach ($matches[1] as $key => $name) { 102 if ($this->hasBadChars($name) 103 || strpos($name, '(discontinued)') !== false) { 104 continue; 105 } 106 $name = explode('/', preg_replace('/\([^)]+\)/', '', $name)); 107 $name = trim(array_shift($name)); 108 if (!empty($name)) { 109 $name = html_entity_decode($name); 110 $names[] = $name; 111 } 112 } 113 $this->populateTable('beer', $names); 114 unset($names); 115 } 116 } 117 118 if ($this->needTable('cocktail')) { 119 $limit = 2; 104 120 $names = array(); 105 foreach ($matches[1] as $key => $name) { 106 if ($this->hasBadChars($name) 107 || strpos($name, '(discontinued)') !== false) { 108 continue; 109 } 110 $name = explode('/', preg_replace('/\([^)]+\)/', '', $name)); 111 $name = trim(array_shift($name)); 112 if (!empty($name)) { 113 $name = html_entity_decode($name); 121 for ($i = 1; $i <= $limit; $i += 150) { 122 $contents = @file_get_contents('http://www.webtender.com/db/browse?level=2&dir=drinks&char=%2A&start=' . $i); 123 if ($contents === false) { 124 break; 125 } 126 if ($i == 1) { 127 preg_match('/>([0-9]+) found\\.</', $contents, $match); 128 $limit = $match[1] + (150 - ($match[1] % 150)); 129 } 130 preg_match_all('/db\\/drink\\/[0-9]+">([^<]+)/', $contents, $matches); 131 foreach ($matches[1] as $name) { 132 if ($this->hasBadChars($name)) { 133 continue; 134 } 135 $name = html_entity_decode(preg_replace('/ The$|^The |\s*\([^)]+\)\s*| #[0-9]+$/', '', $name)); 114 136 $names[] = $name; 115 137 } 116 138 } 117 $this->populateTable('beer', $names); 139 if ($contents) { 140 $this->populateTable('cocktail', $names); 141 } 118 142 unset($names); 119 143 } 120 } 121 122 if ($this->needTable('cocktail')) { 123 $limit = 2; 124 $names = array(); 125 for ($i = 1; $i <= $limit; $i += 150) { 126 $contents = @file_get_contents('http://www.webtender.com/db/browse?level=2&dir=drinks&char=%2A&start=' . $i); 127 if ($contents === false) { 128 break; 129 } 130 if ($i == 1) { 131 preg_match('/>([0-9]+) found\\.</', $contents, $match); 132 $limit = $match[1] + (150 - ($match[1] % 150)); 133 } 134 preg_match_all('/db\\/drink\\/[0-9]+">([^<]+)/', $contents, $matches); 135 foreach ($matches[1] as $name) { 136 if ($this->hasBadChars($name)) { 137 continue; 138 } 139 $name = html_entity_decode(preg_replace('/ The$|^The |\s*\([^)]+\)\s*| #[0-9]+$/', '', $name)); 140 $names[] = $name; 141 } 142 } 143 if ($contents) { 144 $this->populateTable('cocktail', $names); 145 } 146 unset($names); 147 } 148 149 if ($this->needTable('coke')) { 150 $contents = @file_get_contents('http://www.energyfiend.com/huge-caffeine-database/'); 151 if ($contents) { 152 // List of drinks to filter out 153 $filter = array( 154 'tea', 155 'coffee', 156 'starbucks' 157 ); 158 $start = stripos($contents, 'id="caffeinedb"'); 159 $end = stripos($contents, '</table>', $start); 160 $contents = substr($contents, $start, $end - $start); 161 preg_match_all('/<tr[^>]*><td>(<[^>]+>)?([^<]+)/is', $contents, $matches); 162 $names = array(); 163 foreach ($matches[2] as $name) { 164 $name = html_entity_decode(trim(preg_replace('/ \\([^)]+\\)| - .*$/', '', $name))); 165 if (!preg_match('/(?:^|\s+)(?:' . implode('|', $filter) . ')(?:\s+|$)/i', $name)) { 166 $names[] = $name; 167 } 168 } 169 $this->populateTable('coke', $names); 170 unset($names); 171 } 172 } 173 174 if ($this->needTable('tea')) { 175 $names = @file('http://www.midnight-labs.org/tea.txt'); 176 if ($names) { 177 foreach ($names as $key => $value) { 178 $names[$key] = ucwords(rtrim($value)); 179 } 180 $this->populateTable('tea', $names); 181 unset($names); 182 } 183 } 144 145 if ($this->needTable('coke')) { 146 $contents = @file_get_contents('http://www.energyfiend.com/huge-caffeine-database/'); 147 if ($contents) { 148 // List of drinks to filter out 149 $filter = array( 150 'tea', 151 'coffee', 152 'starbucks' 153 ); 154 $start = stripos($contents, 'id="caffeinedb"'); 155 $end = stripos($contents, '</table>', $start); 156 $contents = substr($contents, $start, $end - $start); 157 preg_match_all('/<tr[^>]*><td>(<[^>]+>)?([^<]+)/is', $contents, $matches); 158 $names = array(); 159 foreach ($matches[2] as $name) { 160 $name = html_entity_decode(trim(preg_replace('/ \\([^)]+\\)| - .*$/', '', $name))); 161 if (!preg_match('/(?:^|\s+)(?:' . implode('|', $filter) . ')(?:\s+|$)/i', $name)) { 162 $names[] = $name; 163 } 164 } 165 $this->populateTable('coke', $names); 166 unset($names); 167 } 168 } 169 170 if ($this->needTable('tea')) { 171 $names = @file('http://www.midnight-labs.org/tea.txt'); 172 if ($names) { 173 foreach ($names as $key => $value) { 174 $names[$key] = ucwords(rtrim($value)); 175 } 176 $this->populateTable('tea', $names); 177 unset($names); 178 } 179 } 180 } catch (PDOException $e) { } 184 181 185 182 unset($this->filter); 183 } 184 185 /** 186 * Returns whether or not the plugin's dependencies are met. 187 * 188 * @param array $plugins List of short names for plugins that the 189 * bootstrap file intends to instantiate 190 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 191 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 192 * @return bool TRUE if dependencies are met, FALSE otherwise 193 */ 194 public static function checkDependencies(array $plugins) 195 { 196 if (!extension_loaded('PDO') 197 || !extension_loaded('pdo_sqlite')) { 198 return false; 199 } 200 201 return true; 186 202 } 187 203 trunk/Phergie/Plugin/Karma.php
r76 r78 80 80 if ($static) { 81 81 $this->fixedKarma[strtolower($this->getIni('nick'))] = $static; 82 }83 84 // Check to ensure that the SQLite extension is loaded85 if (!extension_loaded('sqlite')) {86 return;87 82 } 88 83 … … 107 102 108 103 /** 104 * Returns whether or not the plugin's dependencies are met. 105 * 106 * @param array $plugins List of short names for plugins that the 107 * bootstrap file intends to instantiate 108 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 109 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 110 * @return bool TRUE if dependencies are met, FALSE otherwise 111 */ 112 public static function checkDependencies(array $plugins) 113 { 114 if (!extension_loaded('sqlite')) { 115 return false; 116 } 117 118 return true; 119 } 120 121 /** 109 122 * Handles requests for incrementation, decrementation, or lookup of karma 110 123 * ratings sent via messages from users. trunk/Phergie/Plugin/Lart.php
r77 r78 71 71 public function init() 72 72 { 73 // Check for the necessary extensions 74 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 75 return; 76 } 77 78 // Initialize the database connection 79 $db = $this->dir . 'lart.db'; 80 $create = !file_exists($db); 81 $this->db = new PDO('sqlite:' . $db); 82 83 // Create database tables if necessary 84 if ($create) { 85 $this->db->exec(' 86 CREATE TABLE lart ( name VARCHAR(255), definition TEXT ); 87 CREATE UNIQUE INDEX lart_name ON lart (name) 73 try { 74 // Initialize the database connection 75 $db = $this->dir . 'lart.db'; 76 $create = !file_exists($db); 77 $this->db = new PDO('sqlite:' . $db); 78 79 // Create database tables if necessary 80 if ($create) { 81 $this->db->exec(' 82 CREATE TABLE lart ( name VARCHAR(255), definition TEXT ); 83 CREATE UNIQUE INDEX lart_name ON lart (name) 84 '); 85 } 86 87 // Initialize prepared statements for common operations 88 $this->replace = $this->db->prepare(' 89 REPLACE INTO lart (name, definition) VALUES (:name, :definition) 88 90 '); 89 } 90 91 // Initialize prepared statements for common operations 92 $this->replace = $this->db->prepare(' 93 REPLACE INTO lart (name, definition) VALUES (:name, :definition) 94 '); 95 $this->select = $this->db->prepare(' 96 SELECT definition FROM lart WHERE name = :name 97 '); 98 $this->delete = $this->db->prepare(' 99 DELETE FROM lart WHERE name = :name 100 '); 91 $this->select = $this->db->prepare(' 92 SELECT definition FROM lart WHERE name = :name 93 '); 94 $this->delete = $this->db->prepare(' 95 DELETE FROM lart WHERE name = :name 96 '); 97 } catch (PDOException $e) { } 98 } 99 100 /** 101 * Returns whether or not the plugin's dependencies are met. 102 * 103 * @param array $plugins List of short names for plugins that the 104 * bootstrap file intends to instantiate 105 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 106 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 107 * @return bool TRUE if dependencies are met, FALSE otherwise 108 */ 109 public static function checkDependencies(array $plugins) 110 { 111 if (!extension_loaded('PDO') 112 || !extension_loaded('pdo_sqlite')) { 113 return false; 114 } 115 116 return true; 101 117 } 102 118 … … 172 188 public function onAction() 173 189 { 190 if (!$this->db) { 191 return; 192 } 193 174 194 $this->checkLart($this->event->getArgument(1)); 175 195 } … … 183 203 public function onPrivmsg() 184 204 { 205 if (!$this->db) { 206 return; 207 } 208 185 209 $source = $this->event->getArgument(0); 186 210 $message = $this->event->getArgument(1); trunk/Phergie/Plugin/Logging.php
r72 r78 5 5 */ 6 6 require_once 'Phergie/Plugin/Abstract/Command.php'; 7 8 /** 9 * @see Phergie_Plugin_Users 10 */ 11 require_once 'Phergie/Plugin/Users.php'; 7 12 8 13 /** … … 170 175 public function init() 171 176 { 172 // Check for the necessary extensions 173 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 174 return; 175 } 176 177 // Initialize the database connection 178 $db = $this->dir . 'logging.db'; 179 $create = !file_exists($db); 180 $this->db = new PDO('sqlite:' . $db); 181 182 // Create database tables if necessary 183 if ($create) { 184 $result = $this->db->exec(' 185 CREATE TABLE logs ( 186 tstamp VARCHAR(14), 187 type SHORTINT, 188 chan VARCHAR(45), 189 nick VARCHAR(25), 190 message VARCHAR(255) 191 ); 192 CREATE INDEX channicktype ON logs (tstamp, type, chan, nick); 193 CREATE INDEX channick ON logs (tstamp, chan, nick); 177 try { 178 // Initialize the database connection 179 $db = $this->dir . 'logging.db'; 180 $create = !file_exists($db); 181 $this->db = new PDO('sqlite:' . $db); 182 183 // Create database tables if necessary 184 if ($create) { 185 $result = $this->db->exec(' 186 CREATE TABLE logs ( 187 tstamp VARCHAR(14), 188 type SHORTINT, 189 chan VARCHAR(45), 190 nick VARCHAR(25), 191 message VARCHAR(255) 192 ); 193 CREATE INDEX channicktype ON logs (tstamp, type, chan, nick); 194 CREATE INDEX channick ON logs (tstamp, chan, nick); 195 '); 196 } 197 198 // Initialize prepared statements for common operations 199 $this->search = $this->db->prepare(' 200 SELECT tstamp, type, chan, nick, message 201 FROM logs 202 WHERE nick LIKE :phrase 203 OR message LIKE :phrase 204 ORDER BY tstamp DESC 205 LIMIT :limit 194 206 '); 195 } 196 197 // Initialize prepared statements for common operations 198 $this->search = $this->db->prepare(' 199 SELECT tstamp, type, chan, nick, message 200 FROM logs 201 WHERE nick LIKE :phrase 202 OR message LIKE :phrase 203 ORDER BY tstamp DESC 204 LIMIT :limit 205 '); 206 207 $this->seen = $this->db->prepare(' 208 SELECT tstamp, type, message 209 FROM logs 210 WHERE nick = :name 211 AND chan = :chan 212 ORDER BY tstamp DESC 213 LIMIT 1 214 '); 215 216 $this->heard = $this->db->prepare(' 217 SELECT tstamp, type, message 218 FROM logs 219 WHERE type IN (' . self::PRIVMSG . ', ' . self::ACTION . ') 220 AND nick = :nick 221 AND chan = :chan 222 ORDER BY tstamp DESC 223 LIMIT 1 224 '); 225 226 $this->insert = $this->db->prepare(' 227 INSERT INTO logs ( 228 tstamp, 229 type, 230 chan, 231 nick, 232 message 233 ) 234 VALUES ( 235 :tstamp, 236 :type, 237 :chan, 238 :nick, 239 :message 240 ) 241 '); 207 208 $this->seen = $this->db->prepare(' 209 SELECT tstamp, type, message 210 FROM logs 211 WHERE nick = :name 212 AND chan = :chan 213 ORDER BY tstamp DESC 214 LIMIT 1 215 '); 216 217 $this->heard = $this->db->prepare(' 218 SELECT tstamp, type, message 219 FROM logs 220 WHERE type IN (' . self::PRIVMSG . ', ' . self::ACTION . ') 221 AND nick = :nick 222 AND chan = :chan 223 ORDER BY tstamp DESC 224 LIMIT 1 225 '); 226 227 $this->insert = $this->db->prepare(' 228 INSERT INTO logs ( 229 tstamp, 230 type, 231 chan, 232 nick, 233 message 234 ) 235 VALUES ( 236 :tstamp, 237 :type, 238 :chan, 239 :nick, 240 :message 241 ) 242 '); 243 } catch (PDOException $e) { } 244 } 245 246 /** 247 * Returns whether or not the plugin's dependencies are met. 248 * 249 * @param array $plugins List of short names for plugins that the 250 * bootstrap file intends to instantiate 251 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 252 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 253 * @return bool TRUE if dependencies are met, FALSE otherwise 254 */ 255 public static function checkDependencies(array $plugins) 256 { 257 if (! in_array('Users', $plugins) 258 || ! Phergie_Plugin_Users::checkDependencies($plugins)) { 259 return false; 260 } 261 262 if (!extension_loaded('PDO') 263 || !extension_loaded('pdo_sqlite')) { 264 return false; 265 } 266 267 return true; 242 268 } 243 269 … … 289 315 protected function insertEvent($type, $chan, $nick, $message = null) 290 316 { 317 if (!$this->db) { 318 return; 319 } 320 291 321 $params = array( 292 322 ':tstamp' => date('YmdHis'), … … 458 488 public function onDoSearch($phrase) 459 489 { 490 if (!$this->db) { 491 return; 492 } 493 460 494 $source = $this->event->getSource(); 461 495 … … 491 525 public function onDoSeen($user) 492 526 { 527 if (!$this->db) { 528 return; 529 } 530 493 531 // Don't match if user has a space (obviously it's not a nick) 494 532 if (strpos($user, ' ') !== false) { … … 558 596 public function onDoHeard($user) 559 597 { 598 if (!$this->db) { 599 return; 600 } 601 560 602 // Don't match if user has a space (obviously it's not a nick) 561 603 if (strpos($user, ' ') !== false) { trunk/Phergie/Plugin/Nickserv.php
r71 r78 5 5 */ 6 6 require_once 'Phergie/Plugin/Abstract/AdminCommand.php'; 7 8 /** 9 * @see Phergie_Plugin_Users 10 */ 11 require_once 'Phergie/Plugin/Users.php'; 7 12 8 13 /** … … 32 37 33 38 $this->nick = $this->getIni('nick'); 39 } 40 41 /** 42 * Returns whether or not the plugin's dependencies are met. 43 * 44 * @param array $plugins List of short names for plugins that the 45 * bootstrap file intends to instantiate 46 * @return bool TRUE if the plugins dependencies are met, FALSE otherwise 47 * @see Phergie_Plugin_Abstract_Base::checkDependencies() 48 * @return bool TRUE if dependencies are met, FALSE otherwise 49 */ 50 public static function checkDependencies(array $plugins) 51 { 52 return true; 34 53 } 35 54 … … 76 95 public function onDoGhostbust() 77 96 { 78 $password = $this->getPluginIni('password'); 79 $this->debug('password = ' . $password); 97 if (Phergie_Plugin_Users::getInstance() === null) { 98 $password = $this->getPluginIni('password'); 99 $this->debug('password = ' . $password); 80 100 81 if (!empty ($password)) { 82 $this->doPrivmsg( 83 'NickServ', 84 'GHOST ' . $this->nick . ' ' . $password 85 ); 86 } 101 if (!empty ($password)) { 102 $this->doPrivmsg( 103 'NickServ', 104 'GHOST ' . $this->nick . ' ' . $password 105 ); 106 } 107 } 87 108 } 88 109 }