Code Duplication    Length = 29-29 lines in 2 locations

class/utility.php 1 location

@@ 570-598 (lines=29) @@
567
     */
568
569
    // TODO : Move this to the sfFaq class
570
    public static function sf_getAdminLinks($faqid = 0, $open = false)
571
    {
572
        global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
573
        $adminLinks = '';
574
        $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/';
575
        $page       = $open ? 'question.php' : 'faq.php';
576
        if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
577
            // Edit button
578
            $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=mod&amp;faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/edit.gif'" . " title='" . _MD_SF_EDIT . "' alt='" . _MD_SF_EDIT . "'></a>";
579
            $adminLinks .= ' ';
580
            // Delete button
581
            $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=del&amp;faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/delete.gif'" . " title='" . _MD_SF_DELETE . "' alt='" . _MD_SF_DELETE . "'></a>";
582
            $adminLinks .= ' ';
583
        }
584
        // Print button
585
        $adminLinks .= "<a href='" . $modulePath . 'print.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/print.gif' title='" . _MD_SF_PRINT . "' alt='" . _MD_SF_PRINT . "'></a>";
586
        $adminLinks .= ' ';
587
        // Email button
588
        $maillink   = 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . $modulePath . 'faq.php?faqid=' . $faqid;
589
        $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'></a>";
590
        $adminLinks .= ' ';
591
        // Submit New Answer button
592
        if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) {
593
            $adminLinks .= "<a href='" . $modulePath . 'answer.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/newanswer.gif' title='" . _MD_SF_SUBMITANSWER . "' alt='" . _MD_SF_SUBMITANSWER . "'></a>";
594
            $adminLinks .= ' ';
595
        }
596
597
        return $adminLinks;
598
    }
599
600
    /**
601
     * sf_getLinkedUnameFromId()

include/functions.php 1 location

@@ 430-458 (lines=29) @@
427
 */
428
429
// TODO : Move this to the sfFaq class
430
function sf_getAdminLinks($faqid = 0, $open = false)
431
{
432
    global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
433
    $adminLinks = '';
434
    $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/';
435
    $page       = $open ? 'question.php' : 'faq.php';
436
    if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
437
        // Edit button
438
        $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=mod&amp;faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/edit.gif'" . " title='" . _MD_SF_EDIT . "' alt='" . _MD_SF_EDIT . "'></a>";
439
        $adminLinks .= ' ';
440
        // Delete button
441
        $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=del&amp;faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/delete.gif'" . " title='" . _MD_SF_DELETE . "' alt='" . _MD_SF_DELETE . "'></a>";
442
        $adminLinks .= ' ';
443
    }
444
    // Print button
445
    $adminLinks .= "<a href='" . $modulePath . 'print.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/print.gif' title='" . _MD_SF_PRINT . "' alt='" . _MD_SF_PRINT . "'></a>";
446
    $adminLinks .= ' ';
447
    // Email button
448
    $maillink   = 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . $modulePath . 'faq.php?faqid=' . $faqid;
449
    $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'></a>";
450
    $adminLinks .= ' ';
451
    // Submit New Answer button
452
    if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) {
453
        $adminLinks .= "<a href='" . $modulePath . 'answer.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/newanswer.gif' title='" . _MD_SF_SUBMITANSWER . "' alt='" . _MD_SF_SUBMITANSWER . "'></a>";
454
        $adminLinks .= ' ';
455
    }
456
457
    return $adminLinks;
458
}
459
460
/**
461
 * sf_getLinkedUnameFromId()