Assembla home | Assembla project page
 

Changeset 227

Show
Ignore:
Timestamp:
04/13/08 19:15:30 (7 months ago)
Author:
Slynderdale
Message:

Fixed a offset problem in Seen when retrieving records for others and their selves. Tweaked URL a bit to be more verbose why a URL failed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/JoinPart.php

    r223 r227  
    1313     */ 
    1414    public $needsAdmin = true; 
    15  
    16     /** 
    17      * A bool value set to whether the Users plugin is running or not 
    18      * 
    19      * @var bool 
    20      */ 
    21     protected $serverInfoEnabled = null; 
    2215 
    2316    /** 
     
    5851                } else if ($channels == 'all') { 
    5952                    //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')) { 
    6454                        // A fallback, most IRC servers cause the user to part all channels if they try to join 0 
    6555                        $this->doJoin('0'); 
  • trunk/Phergie/Plugin/Seen.php

    r223 r227  
    8484                AND type NOT IN (:type, ' . Phergie_Plugin_Logging::MODE . ', ' . Phergie_Plugin_Logging::TOPIC . ') 
    8585                ORDER BY tstamp DESC 
    86                 LIMIT 1,:limit 
     86                LIMIT :offset,:limit 
    8787            '); 
    8888 
     
    9393                AND type NOT IN (' . Phergie_Plugin_Logging::QUERY . ', ' . Phergie_Plugin_Logging::MODE . ', ' . Phergie_Plugin_Logging::TOPIC . ') 
    9494                ORDER BY tstamp DESC 
    95                 LIMIT 1,1 
     95                LIMIT :offset,1 
    9696            '); 
    9797 
     
    102102                AND LOWER(nick) = LOWER(:name) 
    103103                ORDER BY tstamp DESC 
    104                 LIMIT 1,1 
     104                LIMIT :offset,1 
    105105            '); 
    106106 
     
    121121                AND LOWER(nick) = LOWER(:name) 
    122122                ORDER BY RANDOM() 
    123                 LIMIT 1,1 
     123                LIMIT :offset,1 
    124124            '); 
    125125        } catch (PDOException $e) { } 
     
    183183            ':phrase' => '%' . str_replace(array('\\', '%'), array('\\\\', '\\%'), $phrase) . '%', 
    184184            ':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) 
    186187        ); 
    187188 
     
    244245        // Get the last event from the specified user 
    245246        $params = array( 
    246             ':name' => $user 
     247            ':name' => $user, 
     248            ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 
    247249        ); 
    248250 
     
    303305        // Get the last event from the specified user 
    304306        $params = array( 
    305             ':name' => $user 
     307            ':name' => $user, 
     308            ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 
    306309        ); 
    307310 
     
    368371        // Perform the search 
    369372        $params = array( 
    370             ':nick' => $user 
     373            ':nick' => $user, 
     374            ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 
    371375        ); 
    372376 
     
    434438        // Get the last event from the specified user 
    435439        $params = array( 
    436             ':name' => $user 
     440            ':name' => $user, 
     441            ':offset' => (strtolower($target) == strtolower($user) ? 1 : 0) 
    437442        ); 
    438443 
  • trunk/Phergie/Plugin/Url.php

    r226 r227  
    171171                // Check to see if the URL was from an email address, is a directory, ect 
    172172                if (!empty($m[3])) { 
     173                    $this->debug('Invalid Url: URL is either an email or a directory path. (' . $url . ')'); 
    173174                    continue; 
    174175                } 
     
    176177                // Parse the given URL 
    177178                if (!$parsed = $this->parseURL($url)) { 
     179                    $this->debug('Invalid Url: Could not parse the URL. (' . $url . ')'); 
    178180                    continue; 
    179181                } 
     
    181183                // Check to see if the given IP/Host is valid 
    182184                if (!empty($m[2]) and $this->checkValidIP($m[2])) { 
     185                    $this->debug('Invalid Url: ' . $m[2] . ' is not a valid IP address. (' . $url . ')'); 
    183186                    continue; 
    184187                } 
     
    190193                // Check to see if the URL has a valid TLD 
    191194                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 . ')'); 
    192196                    continue; 
    193197                } 
     
    196200                if ($parsed['scheme'] == 'https' && !extension_loaded('openssl')) { 
    197201                    if (!$this->sslFallback) { 
     202                        $this->debug('Invalid Url: HTTPS is an invalid scheme, OpenSSL isn\'t available. (' . $url . ')'); 
    198203                        continue; 
    199204                    } else { 
     
    203208 
    204209                if (!in_array($parsed['scheme'], array('http', 'https'))) { 
     210                    $this->debug('Invalid Url: ' . $parsed['scheme'] . ' is not a supported scheme. (' . $url . ')'); 
    205211                    continue; 
    206212                } 
     
    213219                // Prevent spamfest 
    214220                if ($this->checkURLCache($url, $tinyUrl)) { 
     221                    $this->debug('Invalid Url: URL is in the cache. (' . $url . ')'); 
    215222                    continue; 
    216223                } 
     
    226233 
    227234                if ($page = fopen($url, 'r', false, $context)) { 
     235                    stream_set_timeout($page, 3.5); 
    228236                    $data = stream_get_meta_data($page); 
    229237                    foreach($data['wrapper_data'] as $header) { 
     
    238246 
    239247                        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                            } 
    240254                            $content .= $chunk; 
    241255                            // Check for timeout 
     
    263277                    } 
    264278                    fclose($page); 
     279                } else if (!$this->errorStatus) { 
     280                    $this->debug('Couldn\t Open Url: ' . $url); 
    265281                } 
    266282 
    267283                if (empty($title)) { 
    268284                    if ($this->errorStatus) { 
    269                         if (!$this->showErrors || $this->errorStatus == 1) { 
     285                        if (!$this->showErrors || empty($this->errorMessage)) { 
    270286                            continue; 
    271287                        } 
     
    433449                       stripos($errstr, 'SSL operation failed with code') !== false || 
    434450                       stripos($errstr, 'unable to connect to') !== false) { 
    435                 $this->errorStatus = 1
     451                $this->errorStatus = true
    436452                $this->debug('PHP Warning:  ' . $errstr . 'in ' . $errfile . ' on line ' . $errline); 
    437453                return true;