Code Duplication    Length = 28-28 lines in 2 locations

api/functions.php 2 locations

@@ 1488-1515 (lines=28) @@
1485
                                WHERE title = %s",
1486
                                "teampass-connect"
1487
                            );
1488
                            if (DB::count() == 0) {
1489
                                DB::insert(
1490
                                    prefix_table("nested_tree"),
1491
                                    array(
1492
                                        'parent_id' => '0',
1493
                                        'title' => "teampass-connect"
1494
                                    )
1495
                                );
1496
                                $tpc_folder_id = DB::insertId();
1497
1498
                                //Add complexity
1499
                                DB::insert(
1500
                                    prefix_table("misc"),
1501
                                    array(
1502
                                        'type' => 'complex',
1503
                                        'intitule' => $tpc_folder_id,
1504
                                        'valeur' => '0'
1505
                                    )
1506
                                );
1507
1508
                                // rebuild tree
1509
                                $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1510
                                $tree->register();
1511
                                $tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title');
1512
                                $tree->rebuild();
1513
                            } else {
1514
                                $tpc_folder_id = $folder['id'];
1515
                            }
1516
1517
                            // encrypt password
1518
                            $encrypt = cryption(
@@ 1652-1679 (lines=28) @@
1649
                                    WHERE title = %s",
1650
                                    "teampass-connect"
1651
                                );
1652
                                if (DB::count() == 0) {
1653
                                    DB::insert(
1654
                                        prefix_table("nested_tree"),
1655
                                        array(
1656
                                            'parent_id' => '0',
1657
                                            'title' => "teampass-connect"
1658
                                        )
1659
                                    );
1660
                                    $tpc_folder_id = DB::insertId();
1661
1662
                                    //Add complexity
1663
                                    DB::insert(
1664
                                        prefix_table("misc"),
1665
                                        array(
1666
                                            'type' => 'complex',
1667
                                            'intitule' => $tpc_folder_id,
1668
                                            'valeur' => '0'
1669
                                        )
1670
                                    );
1671
1672
                                    // rebuild tree
1673
                                    $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1674
                                    $tree->register();
1675
                                    $tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title');
1676
                                    $tree->rebuild();
1677
                                } else {
1678
                                    $tpc_folder_id = $folder['id'];
1679
                                }
1680
                            } else {
1681
                                $tpc_folder_id = $user_folder['id'];
1682
                            }