Code Duplication    Length = 49-52 lines in 3 locations

class/pcltar.lib.php 3 locations

@@ 458-509 (lines=52) @@
455
     *
456
     * @return int
457
     */
458
    function PclTarExtractList($p_tarname, $p_filelist, $p_path = './', $p_remove_path = '', $p_mode = '')
459
    {
460
        TrFctStart(__FILE__, __LINE__, 'PclTarExtractList', "tar=$p_tarname, list, path=$p_path, remove_path='$p_remove_path', mode='$p_mode'");
461
        $v_result = 1;
462
463
        // ----- Extract the tar format from the extension
464
        if (($p_mode == '') || (($p_mode !== 'tar') && ($p_mode !== 'tgz'))) {
465
            if (($p_mode = PclTarHandleExtension($p_tarname)) == '') {
466
                // ----- Return
467
                TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
468
469
                return 0;
470
            }
471
        }
472
473
        // ----- Look if the $p_filelist is really an array
474
        if (is_array($p_filelist)) {
475
            // ----- Call the extracting fct
476
            if (($v_result = PclTarHandleExtract($p_tarname, $p_filelist, $p_list, 'partial', $p_path, $v_tar_mode, $p_remove_path)) != 1) {
477
                TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
478
479
                return 0;
480
            }
481
        } // ----- Look if the $p_filelist is a string
482
        else {
483
            if (is_string($p_filelist)) {
484
                // ----- Create a list with the elements from the string
485
                $v_list = explode(' ', $p_filelist);
486
487
                // ----- Call the extracting fct
488
                if (($v_result = PclTarHandleExtract($p_tarname, $v_list, $p_list, 'partial', $p_path, $v_tar_mode, $p_remove_path)) != 1) {
489
                    TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
490
491
                    return 0;
492
                }
493
            } // ----- Invalid variable
494
            else {
495
                // ----- Error log
496
                PclErrorLog(-3, 'Invalid variable type p_filelist');
497
498
                // ----- Return
499
                TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
500
501
                return 0;
502
            }
503
        }
504
505
        // ----- Return
506
        TrFctEnd(__FILE__, __LINE__, $p_list);
507
508
        return $p_list;
509
    }
510
511
    // --------------------------------------------------------------------------------
512
@@ 553-601 (lines=49) @@
550
     *
551
     * @return int
552
     */
553
    function PclTarExtractIndex($p_tarname, $p_index, $p_path = './', $p_remove_path = '', $p_mode = '')
554
    {
555
        TrFctStart(__FILE__, __LINE__, 'PclTarExtractIndex', "tar=$p_tarname, index='$p_index', path=$p_path, remove_path='$p_remove_path', mode='$p_mode'");
556
        $v_result = 1;
557
558
        // ----- Extract the tar format from the extension
559
        if (($p_mode == '') || (($p_mode !== 'tar') && ($p_mode !== 'tgz'))) {
560
            if (($p_mode = PclTarHandleExtension($p_tarname)) == '') {
561
                // ----- Return
562
                TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
563
564
                return 0;
565
            }
566
        }
567
568
        // ----- Look if the $p_index is really an integer
569
        if (is_int($p_index)) {
570
            // ----- Call the extracting fct
571
            if (($v_result = PclTarHandleExtractByIndexList($p_tarname, "$p_index", $p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1) {
572
                TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
573
574
                return 0;
575
            }
576
        } // ----- Look if the $p_filelist is a string
577
        else {
578
            if (is_string($p_index)) {
579
                // ----- Call the extracting fct
580
                if (($v_result = PclTarHandleExtractByIndexList($p_tarname, $p_index, $p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1) {
581
                    TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
582
583
                    return 0;
584
                }
585
            } // ----- Invalid variable
586
            else {
587
                // ----- Error log
588
                PclErrorLog(-3, "Invalid variable type $p_index");
589
590
                // ----- Return
591
                TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
592
593
                return 0;
594
            }
595
        }
596
597
        // ----- Return
598
        TrFctEnd(__FILE__, __LINE__, $p_list);
599
600
        return $p_list;
601
    }
602
603
    // --------------------------------------------------------------------------------
604
@@ 705-756 (lines=52) @@
702
     *
703
     * @return int
704
     */
705
    function PclTarUpdate($p_tarname, $p_filelist, $p_mode = '', $p_add_dir = '', $p_remove_dir = '')
706
    {
707
        TrFctStart(__FILE__, __LINE__, 'PclTarUpdate', "tar='$p_tarname', list='$p_filelist', mode='$p_mode'");
708
        $v_result = 1;
709
710
        // ----- Extract the tar format from the extension
711
        if (($p_mode == '') || (($p_mode !== 'tar') && ($p_mode !== 'tgz'))) {
712
            if (($p_mode = PclTarHandleExtension($p_tarname)) == '') {
713
                // ----- Return
714
                TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
715
716
                return 0;
717
            }
718
        }
719
720
        // ----- Look if the $p_filelist is really an array
721
        if (is_array($p_filelist)) {
722
            // ----- Call the extracting fct
723
            if (($v_result = PclTarHandleUpdate($p_tarname, $p_filelist, $p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1) {
724
                TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
725
726
                return 0;
727
            }
728
        } // ----- Look if the $p_filelist is a string
729
        else {
730
            if (is_string($p_filelist)) {
731
                // ----- Create a list with the elements from the string
732
                $v_list = explode(' ', $p_filelist);
733
734
                // ----- Call the extracting fct
735
                if (($v_result = PclTarHandleUpdate($p_tarname, $v_list, $p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1) {
736
                    TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
737
738
                    return 0;
739
                }
740
            } // ----- Invalid variable
741
            else {
742
                // ----- Error log
743
                PclErrorLog(-3, 'Invalid variable type p_filelist');
744
745
                // ----- Return
746
                TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
747
748
                return 0;
749
            }
750
        }
751
752
        // ----- Return
753
        TrFctEnd(__FILE__, __LINE__, $p_list);
754
755
        return $p_list;
756
    }
757
758
    // --------------------------------------------------------------------------------
759