Code Duplication    Length = 20-20 lines in 2 locations

class/pcltar.lib.php 2 locations

@@ 884-903 (lines=20) @@
881
            $v_buffer = gzread($p_tar, 512);
882
883
            // ----- Read the following blocks but not the last one
884
            if (!gzeof($p_tar)) {
885
                TrFctMessage(__FILE__, __LINE__, 3, 'More than one 512 block file');
886
                $i = 1;
887
888
                // ----- Read new 512 block and write the already read
889
                do {
890
                    // ----- Write the already read block
891
                    $v_binary_data = pack('a512', "$v_buffer");
892
                    gzputs($v_temp_tar, $v_binary_data);
893
894
                    ++$i;
895
                    TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i");
896
897
                    // ----- Read next block
898
                    $v_buffer = gzread($p_tar, 512);
899
                } while (!gzeof($p_tar));
900
901
                TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks");
902
            }
903
        } // ----- Look for uncompressed tar file
904
        else {
905
            if ($p_mode === 'tar') {
906
                // ----- Open the tar file
@@ 1253-1272 (lines=20) @@
1250
            $v_buffer = gzread($p_tar, 512);
1251
1252
            // ----- Read the following blocks but not the last one
1253
            if (!gzeof($p_tar)) {
1254
                TrFctMessage(__FILE__, __LINE__, 3, 'More than one 512 block file');
1255
                $i = 1;
1256
1257
                // ----- Read new 512 block and write the already read
1258
                do {
1259
                    // ----- Write the already read block
1260
                    $v_binary_data = pack('a512', "$v_buffer");
1261
                    gzputs($v_temp_tar, $v_binary_data);
1262
1263
                    ++$i;
1264
                    TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i");
1265
1266
                    // ----- Read next block
1267
                    $v_buffer = gzread($p_tar, 512);
1268
                } while (!gzeof($p_tar));
1269
1270
                TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks");
1271
            }
1272
1273
            // ----- Call the adding fct inside the tar
1274
            if (($v_result = PclTarHandleAddList($v_temp_tar, $p_list, $p_mode, $p_list_detail, $p_add_dir, $p_remove_dir)) == 1) {
1275
                // ----- Call the footer of the tar archive