Changeset 227
- Timestamp:
- 04/13/08 19:15:30 (7 months ago)
- Files:
-
- trunk/Phergie/Plugin/JoinPart.php (modified) (2 diffs)
- trunk/Phergie/Plugin/Seen.php (modified) (9 diffs)
- trunk/Phergie/Plugin/Url.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Plugin/JoinPart.php
r223 r227 13 13 */ 14 14 public $needsAdmin = true; 15 16 /**17 * A bool value set to whether the Users plugin is running or not18 *19 * @var bool20 */21 protected $serverInfoEnabled = null;22 15 23 16 /** … … 58 51 } else if ($channels == 'all') { 59 52 //Check to see if the Users plugin is enabled to retrieve a list of channels 60 if (!isset($this->serverInfoEnabled)) { 61 $this->serverInfoEnabled = $this->pluginLoaded('ServerInfo'); 62 } 63 if (!$this->serverInfoEnabled) { 53 if (!$this->pluginLoaded('ServerInfo')) { 64 54 // A fallback, most IRC servers cause the user to part all channels if they try to join 0 65 55 $this->doJoin('0'); trunk/Phergie/Plugin/Seen.php
r223 r227 84 84 AND type NOT IN (:type, ' . Phergie_Plugin_Logging::MODE . ', ' . Phergie_Plugin_Logging::TOPIC . ') 85 85 ORDER BY tstamp DESC 86 LIMIT 1,:limit86 LIMIT :offset,:limit 87 87 '); 88 88 … … 93 93 AND type NOT IN (' . Phergie_Plugin_Logging::QUERY . ', ' . Phergie_Plugin_Logging::MODE . ', ' . Phergie_Plugin_Logging::TOPIC . ') 94 94 ORDER BY tstamp DESC 95 LIMIT 1,195 LIMIT :offset,1 96 96 '); 97 97 … … 102 102 AND LOWER(nick) = LOWER(:name) 103 103 ORDER BY tstamp DESC 104 LIMIT 1,1104 LIMIT :offset,1 105 105 '); 106 106 … … 121 121 AND LOWER(nick) = LOWER(:name) 122 122 ORDER BY RANDOM() 123 LIMIT 1,1123 LIMIT :offset,1 124 124 '); 125 125 } catch (PDOException $e) { } … … 183 183 ':phrase' => '%' . str_replace(array('\\', '%'), array('\\\\', '\\%'), $phrase) . '%', 184 184 ':limit' => ($source[0] == '#' ? 1 : 6), 185 ':type' => ($searchAll ? '0' : Phergie_Plugin_Logging::QUERY) 185 ':type' => ($searchAll ? '0' : Phergie_Plugin_Logging::QUERY), 186 ':offset' => (strtolower($target) == strtolower($phrase) ? 1 : 0) 186 187 ); 187 188 … … 244 245 // Get the last event from the specified user 245 246 $params = array( 246 ':name' => $user 247 ':name' => $user, 248 ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 247 249 ); 248 250 … … 303 305 // Get the last event from the specified user 304 306 $params = array( 305 ':name' => $user 307 ':name' => $user, 308 ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 306 309 ); 307 310 … … 368 371 // Perform the search 369 372 $params = array( 370 ':nick' => $user 373 ':nick' => $user, 374 ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 371 375 ); 372 376 … … 434 438 // Get the last event from the specified user 435 439 $params = array( 436 ':name' => $user 440 ':name' => $user, 441 ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 437 442 ); 438 443 trunk/Phergie/Plugin/Url.php
r226 r227 171 171 // Check to see if the URL was from an email address, is a directory, ect 172 172 if (!empty($m[3])) { 173 $this->debug('Invalid Url: URL is either an email or a directory path. (' . $url . ')'); 173 174 continue; 174 175 } … … 176 177 // Parse the given URL 177 178 if (!$parsed = $this->parseURL($url)) { 179 $this->debug('Invalid Url: Could not parse the URL. (' . $url . ')'); 178 180 continue; 179 181 } … … 181 183 // Check to see if the given IP/Host is valid 182 184 if (!empty($m[2]) and $this->checkValidIP($m[2])) { 185 $this->debug('Invalid Url: ' . $m[2] . ' is not a valid IP address. (' . $url . ')'); 183 186 continue; 184 187 } … … 190 193 // Check to see if the URL has a valid TLD 191 194 if (is_array($this->tldList) && !in_array(strtolower($parsed['tld']), $this->tldList)) { 195 $this->debug('Invalid Url: ' . $parsed['tld'] . ' is not a supported TLD. (' . $url . ')'); 192 196 continue; 193 197 } … … 196 200 if ($parsed['scheme'] == 'https' && !extension_loaded('openssl')) { 197 201 if (!$this->sslFallback) { 202 $this->debug('Invalid Url: HTTPS is an invalid scheme, OpenSSL isn\'t available. (' . $url . ')'); 198 203 continue; 199 204 } else { … … 203 208 204 209 if (!in_array($parsed['scheme'], array('http', 'https'))) { 210 $this->debug('Invalid Url: ' . $parsed['scheme'] . ' is not a supported scheme. (' . $url . ')'); 205 211 continue; 206 212 } … … 213 219 // Prevent spamfest 214 220 if ($this->checkURLCache($url, $tinyUrl)) { 221 $this->debug('Invalid Url: URL is in the cache. (' . $url . ')'); 215 222 continue; 216 223 } … … 226 233 227 234 if ($page = fopen($url, 'r', false, $context)) { 235 stream_set_timeout($page, 3.5); 228 236 $data = stream_get_meta_data($page); 229 237 foreach($data['wrapper_data'] as $header) { … … 238 246 239 247 while ($chunk = fread($page, 64)) { 248 $data = stream_get_meta_data($page); 249 if ($data['timed_out']) { 250 $this->debug('Url Timed Out: ' . $url); 251 $this->errorStatus = true; 252 break; 253 } 240 254 $content .= $chunk; 241 255 // Check for timeout … … 263 277 } 264 278 fclose($page); 279 } else if (!$this->errorStatus) { 280 $this->debug('Couldn\t Open Url: ' . $url); 265 281 } 266 282 267 283 if (empty($title)) { 268 284 if ($this->errorStatus) { 269 if (!$this->showErrors || $this->errorStatus == 1) {285 if (!$this->showErrors || empty($this->errorMessage)) { 270 286 continue; 271 287 } … … 433 449 stripos($errstr, 'SSL operation failed with code') !== false || 434 450 stripos($errstr, 'unable to connect to') !== false) { 435 $this->errorStatus = 1;451 $this->errorStatus = true; 436 452 $this->debug('PHP Warning: ' . $errstr . 'in ' . $errfile . ' on line ' . $errline); 437 453 return true;