Code Duplication    Length = 35-36 lines in 2 locations

class/Utility.php 1 location

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

include/functions.php 1 location

@@ 235-269 (lines=35) @@
232
    return $srvlinks2;
233
}
234
235
function lx_showSearchForm() {
236
    global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
237
    $gperm_handler = xoops_gethandler('groupperm');
238
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
239
    
240
    $searchform = "<table style=\"width:100%;\">";
241
    $searchform .= "<form name=\"op\" id=\"op\" action=\"search.php\" method=\"post\">";
242
    $searchform .= "<tr><td style=\"text-align: right; line-height: 200%; width:150px;\">";
243
    $searchform .= _MD_LEXIKON_LOOKON."</td><td style=\"width:10px;\">&nbsp;</td><td style=\"text-align: left;\">";
244
    $searchform .= "<select name=\"type\"><option value=\"1\">"._MD_LEXIKON_TERMS."</option><option value=\"2\">"._MD_LEXIKON_DEFINS."</option>";
245
    $searchform .= "<option SELECTED value=\"3\">"._MD_LEXIKON_TERMSDEFS."</option></select></td></tr>";
246
247
    if ($xoopsModuleConfig['multicats'] == 1) {
248
        $searchform .= "<tr><td style=\"text-align: right; line-height: 200%;\">"._MD_LEXIKON_CATEGORY."</td>";
249
        $searchform .= "<td>&nbsp;</td><td style=\"text-align: left;\">";
250
        $resultcat = $xoopsDB -> query ( "SELECT categoryID, name FROM " . $xoopsDB -> prefix ( "lxcategories") . " ORDER BY categoryID" );
251
        $searchform .= "<select name=\"categoryID\">";
252
        $searchform .= "<option value=\"0\">"._MD_LEXIKON_ALLOFTHEM."</option>";
253
254
        while (list( $categoryID, $name) = $xoopsDB->fetchRow($resultcat)) {
255
            if ($gperm_handler->checkRight('lexikon_view', intval($categoryID), $groups, $xoopsModule->getVar('mid'))) {
256
                $searchform .= "<option value=\"$categoryID\">$categoryID : $name</option>";
257
            }
258
        }
259
        $searchform .= "</select></td></tr>";
260
    }
261
262
    $searchform .= "<tr><td style=\"text-align: right; line-height: 200%;\">";
263
    $searchform .= _MD_LEXIKON_TERM."</td><td>&nbsp;</td><td style=\"text-align: left;\">";
264
    $searchform .= "<input type=\"text\" name=\"term\" class=\"searchBox\" /></td></tr><tr>";
265
    $searchform .= "<td>&nbsp;</td><td>&nbsp;</td><td><input type=\"submit\" class=\"btnDefault\" value=\""._MD_LEXIKON_SEARCH."\" />";
266
    $searchform .= "</td></tr></form></table>";
267
268
    return $searchform;
269
}
270
271
function lx_getHTMLHighlight($needle, $haystack, $hlS, $hlE) {
272
    $parts = explode(">", $haystack);