Code Duplication    Length = 16-16 lines in 2 locations

htdocs/xoops_lib/modules/protector/class/protector.php 2 locations

@@ 334-349 (lines=16) @@
331
     *
332
     * @return bool
333
     */
334
    public function write_file_bwlimit($expire)
335
    {
336
        $expire = min((int)$expire, time() + 300);
337
338
        $fp = @fopen($this->get_filepath4bwlimit(), 'w');
339
        if ($fp) {
340
            @flock($fp, LOCK_EX);
341
            fwrite($fp, $expire . "\n");
342
            @flock($fp, LOCK_UN);
343
            fclose($fp);
344
345
            return true;
346
        } else {
347
            return false;
348
        }
349
    }
350
351
    /**
352
     * @return mixed
@@ 375-390 (lines=16) @@
372
     *
373
     * @return bool
374
     */
375
    public function write_file_badips($bad_ips)
376
    {
377
        asort($bad_ips);
378
379
        $fp = @fopen($this->get_filepath4badips(), 'w');
380
        if ($fp) {
381
            @flock($fp, LOCK_EX);
382
            fwrite($fp, serialize($bad_ips) . "\n");
383
            @flock($fp, LOCK_UN);
384
            fclose($fp);
385
386
            return true;
387
        } else {
388
            return false;
389
        }
390
    }
391
392
    /**
393
     * @param int  $jailed_time