Code Duplication    Length = 9-12 lines in 2 locations

htdocs/class/smarty/plugins/function.fetch.php 2 locations

@@ 40-48 (lines=9) @@
37
        }
38
        
39
        // fetch the file
40
        if($fp = @fopen($params['file'],'r')) {
41
            while(!feof($fp)) {
42
                $content .= fgets ($fp,4096);
43
            }
44
            fclose($fp);
45
        } else {
46
            $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\'');
47
            return;
48
        }
49
    } else {
50
        // not a local file
51
        if(preg_match('!^http://!i',$params['file'])) {
@@ 196-207 (lines=12) @@
193
                $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax");
194
                return;
195
            }
196
        } else {
197
            // ftp fetch
198
            if($fp = @fopen($params['file'],'r')) {
199
                while(!feof($fp)) {
200
                    $content .= fgets ($fp,4096);
201
                }
202
                fclose($fp);
203
            } else {
204
                $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'');
205
                return;
206
            }
207
        }
208
209
    }
210