Code Duplication    Length = 35-36 lines in 2 locations

include/functions.php 1 location

@@ 303-337 (lines=35) @@
300
    return $srvlinks2;
301
}
302
303
function lx_showSearchForm() {
304
    global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
305
    $gperm_handler = xoops_gethandler('groupperm');
306
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
307
    
308
    $searchform = "<table style=\"width:100%;\">";
309
    $searchform .= "<form name=\"op\" id=\"op\" action=\"search.php\" method=\"post\">";
310
    $searchform .= "<tr><td style=\"text-align: right; line-height: 200%; width:150px;\">";
311
    $searchform .= _MD_LEXIKON_LOOKON."</td><td style=\"width:10px;\">&nbsp;</td><td style=\"text-align: left;\">";
312
    $searchform .= "<select name=\"type\"><option value=\"1\">"._MD_LEXIKON_TERMS."</option><option value=\"2\">"._MD_LEXIKON_DEFINS."</option>";
313
    $searchform .= "<option SELECTED value=\"3\">"._MD_LEXIKON_TERMSDEFS."</option></select></td></tr>";
314
315
    if ($xoopsModuleConfig['multicats'] == 1) {
316
        $searchform .= "<tr><td style=\"text-align: right; line-height: 200%;\">"._MD_LEXIKON_CATEGORY."</td>";
317
        $searchform .= "<td>&nbsp;</td><td style=\"text-align: left;\">";
318
        $resultcat = $xoopsDB -> query ( "SELECT categoryID, name FROM " . $xoopsDB -> prefix ( "lxcategories") . " ORDER BY categoryID" );
319
        $searchform .= "<select name=\"categoryID\">";
320
        $searchform .= "<option value=\"0\">"._MD_LEXIKON_ALLOFTHEM."</option>";
321
322
        while (list( $categoryID, $name) = $xoopsDB->fetchRow($resultcat)) {
323
            if ($gperm_handler->checkRight('lexikon_view', intval($categoryID), $groups, $xoopsModule->getVar('mid'))) {
324
                $searchform .= "<option value=\"$categoryID\">$categoryID : $name</option>";
325
            }
326
        }
327
        $searchform .= "</select></td></tr>";
328
    }
329
330
    $searchform .= "<tr><td style=\"text-align: right; line-height: 200%;\">";
331
    $searchform .= _MD_LEXIKON_TERM."</td><td>&nbsp;</td><td style=\"text-align: left;\">";
332
    $searchform .= "<input type=\"text\" name=\"term\" class=\"searchBox\" /></td></tr><tr>";
333
    $searchform .= "<td>&nbsp;</td><td>&nbsp;</td><td><input type=\"submit\" class=\"btnDefault\" value=\""._MD_LEXIKON_SEARCH."\" />";
334
    $searchform .= "</td></tr></form></table>";
335
336
    return $searchform;
337
}
338
339
function lx_getHTMLHighlight($needle, $haystack, $hlS, $hlE) {
340
    $parts = explode(">", $haystack);

class/Utility.php 1 location

@@ 557-592 (lines=36) @@
554
    /**
555
     * @return string
556
     */
557
public static function showSearchForm()
558
{
559
    global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
560
    $gpermHandler = xoops_getHandler('groupperm');
561
    $groups       = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
562
563
    $searchform = "<table style=\"width:100%;\">";
564
    $searchform .= "<form name=\"op\" id=\"op\" action=\"search.php\" method=\"post\">";
565
    $searchform .= "<tr><td style=\"text-align: right; line-height: 200%; width:150px;\">";
566
    $searchform .= _MD_LEXIKON_LOOKON . "</td><td style=\"width:10px;\">&nbsp;</td><td style=\"text-align: left;\">";
567
    $searchform .= "<select name=\"type\"><option value=\"1\">" . _MD_LEXIKON_TERMS . "</option><option value=\"2\">" . _MD_LEXIKON_DEFINS . '</option>';
568
    $searchform .= "<option SELECTED value=\"3\">" . _MD_LEXIKON_TERMSDEFS . '</option></select></td></tr>';
569
570
    if ($xoopsModuleConfig['multicats'] == 1) {
571
        $searchform .= "<tr><td style=\"text-align: right; line-height: 200%;\">" . _MD_LEXIKON_CATEGORY . '</td>';
572
        $searchform .= "<td>&nbsp;</td><td style=\"text-align: left;\">";
573
        $resultcat  = $xoopsDB->query('SELECT categoryID, name FROM ' . $xoopsDB->prefix('lxcategories') . ' ORDER BY categoryID');
574
        $searchform .= "<select name=\"categoryID\">";
575
        $searchform .= "<option value=\"0\">" . _MD_LEXIKON_ALLOFTHEM . '</option>';
576
577
        while (list($categoryID, $name) = $xoopsDB->fetchRow($resultcat)) {
578
            if ($gpermHandler->checkRight('lexikon_view', (int)$categoryID, $groups, $xoopsModule->getVar('mid'))) {
579
                $searchform .= "<option value=\"$categoryID\">$categoryID : $name</option>";
580
            }
581
        }
582
        $searchform .= '</select></td></tr>';
583
    }
584
585
    $searchform .= "<tr><td style=\"text-align: right; line-height: 200%;\">";
586
    $searchform .= _MD_LEXIKON_TERM . "</td><td>&nbsp;</td><td style=\"text-align: left;\">";
587
    $searchform .= "<input type=\"text\" name=\"term\" class=\"searchBox\" /></td></tr><tr>";
588
    $searchform .= "<td>&nbsp;</td><td>&nbsp;</td><td><input type=\"submit\" class=\"btnDefault\" value=\"" . _MD_LEXIKON_SEARCH . "\" />";
589
    $searchform .= '</td></tr></form></table>';
590
591
    return $searchform;
592
}
593
594
    /**
595
     * @param $needle