Code Duplication    Length = 13-16 lines in 2 locations

manager/actions/search.static.php 2 locations

@@ 313-325 (lines=13) @@
310
                }
311
312
                //templates
313
                if ($modx->hasPermission('edit_template')) {
314
                    $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' 
315
					OR `templatename` like '%" . $searchfields . "%' 
316
					OR `description` like '%" . $searchfields . "%' 
317
					OR `content` like '%" . $searchfields . "%'");
318
                    $templatecounts = $modx->getDatabase()->getRecordCount($rs);
319
                    if ($templatecounts > 0) {
320
                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>';
321
                        while ($row = $modx->getDatabase()->getRow($rs)) {
322
                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>';
323
                        }
324
                    }
325
                }
326
327
                //tvs
328
                if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
@@ 350-365 (lines=16) @@
347
                }
348
349
                //Chunks
350
                if ($modx->hasPermission('edit_chunk')) {
351
                    $rs = $modx->getDatabase()->select(
352
                            "id,name,locked,disabled",
353
                            $modx->getDatabase()->getFullTableName('site_htmlsnippets'),
354
                            "`id` like '%" . $searchfields . "%' 
355
					OR `name` like '%" . $searchfields . "%' 
356
					OR `description` like '%" . $searchfields . "%'     
357
					OR `snippet` like '%" . $searchfields . "%'");
358
                    $chunkscounts = $modx->getDatabase()->getRecordCount($rs);
359
                    if ($chunkscounts > 0) {
360
                        $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>';
361
                        while ($row = $modx->getDatabase()->getRow($rs)) {
362
                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>';
363
                        }
364
                    }
365
                }
366
367
                //Snippets
368
                if ($modx->hasPermission('edit_snippet')) {