Code Duplication    Length = 8-9 lines in 3 locations

plugin/sepe/ws/Sepe.php 2 locations

@@ 404-412 (lines=9) @@
401
                            $centerCode = $centro->CODIGO_CENTRO;
402
                            $sql = "SELECT id FROM $tableCenters WHERE center_origin='".$centerOrigin."' AND center_code='".$centerCode."';";
403
                            $res = Database::query($sql);
404
                            if (Database::num_rows($res)>0) {
405
                                $aux_row = Database::fetch_assoc($res);
406
                                $centerId = $aux_row['id'];
407
                            } else {
408
                                $sql = "INSERT INTO $tableCenters (center_origin, center_code)
409
                                        VALUES ('" . $centerOrigin . "','" . $centerCode . "');";
410
                                Database::query($sql);
411
                                $centerId = Database::insert_id();
412
                            }
413
                            $sql = "INSERT INTO $tableSpecialtyClassroom (specialty_id, center_id)
414
                                    VALUES ('" . $specialtyId . "','" . $centerId . "')";
415
                            Database::query($sql);
@@ 454-462 (lines=9) @@
451
                                $sql = "SELECT id FROM $tableTutors WHERE 
452
                                document_type='".$documentType."' AND document_number='".$documentNumber."' AND document_letter='".$documentLetter."';";
453
                                $res = Database::query($sql);
454
                                if (Database::num_rows($res)>0) {
455
                                    $aux_row = Database::fetch_assoc($res);
456
                                    $tutorId = $aux_row['id'];
457
                                } else {
458
                                    $sql = "INSERT INTO $tableTutors (document_type, document_number, document_letter)
459
                                        VALUES ('" . $documentType . "','" . $documentNumber . "','" . $documentLetter . "');";
460
                                    Database::query($sql);
461
                                    $tutorId = Database::insert_id();
462
                                }
463
                                if (empty($tutorId)) {
464
                                    return array(
465
                                        "RESPUESTA_OBT_ACCION" => array(

main/inc/lib/document.lib.php 1 location

@@ 6184-6191 (lines=8) @@
6181
            if (!empty($tmp_folders_titles[$tmp_path])) {
6182
                // If this path has soon been stored here we don't need a new query
6183
                $path_displayed .= $tmp_folders_titles[$tmp_path];
6184
            } else {
6185
                $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).'
6186
                    WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"';
6187
                $rs = Database::query($sql);
6188
                $tmp_title = '/'.Database::result($rs, 0, 0);
6189
                $path_displayed .= $tmp_title;
6190
                $tmp_folders_titles[$tmp_path] = $tmp_title;
6191
            }
6192
        }
6193
6194
        return $path_displayed;