Code Duplication    Length = 35-36 lines in 2 locations

class/Utility.php 1 location

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

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);