Code Duplication    Length = 83-83 lines in 2 locations

class/utility.php 1 location

@@ 682-764 (lines=83) @@
679
        echo "<br>\n";
680
    }
681
682
    public static function showSubmissions()
683
    {
684
        global $xoopsGTicket;
685
        global $xoopsModuleConfig, $xoopsModule;
686
687
        $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16);
688
        $myts       = MyTextSanitizer::getInstance();
689
        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
690
        require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
691
        require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
692
        require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php';
693
        $module_id = $xoopsModule->getVar('mid');
694
        $startsub  = isset($_GET['startsub']) ? (int)$_GET['startsub'] : 0;
695
        $datesub   = isset($_GET['datesub']) ? (int)$_GET['datesub'] : 0;
696
697
        //---GET view sort --
698
        $sortname = isset($_GET['sortname']) ? strtolower(trim(strip_tags($myts->stripSlashesGPC($_GET['sortname'])))) : 'datesub';
699
        if (!in_array($sortname, array('datesub', 'weight', 'counter', 'rating', 'headline'))) {
700
            $sortname = 'datesub';
701
        }
702
        $sortorder = isset($_GET['sortorder']) ? strtoupper(trim(strip_tags($myts->stripSlashesGPC($_GET['sortorder'])))) : 'DESC';
703
        if (!in_array($sortorder, array('ASC', 'DESC'))) {
704
            $sortorder = 'DESC';
705
        }
706
        //---------------
707
        /* Code to show submitted articles */
708
        echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWSUBMISSIONS . '</h3>';
709
        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_SUBTEXT . '</span>';
710
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
711
        echo '<tr>';
712
        echo "<td width='40' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTID . '</b></td>';
713
        echo "<td width='20%' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTCOLNAME . '</b></td>';
714
        echo "<td width='45%' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTHEADLINE . '</b></td>';
715
        echo "<td width='90' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTCREATED . '</b></td>';
716
        echo "<td width='60' class='bg3' align='center'><b>" . _AM_SOAPBOX_ACTION . '</b></td>';
717
        echo '</tr>';
718
719
        // Put column names in an array, to avoid a query in the while loop farther ahead
720
        /* Code to show submitted articles */
721
        // Articles count
722
        //    function &getArticlesAllPermcheck(
723
        //         $limit=0, $start=0,
724
        //         $checkRight = true, $published = true, $submit = 0, $offline = 0, $block = null ,
725
        //         $sortname = 'datesub', $sortorder = 'DESC',
726
        //         $select_sbcolumns = null , $NOTarticleIDs = null ,
727
        //         $approve_submit = false ,
728
        //         $id_as_key = false )
729
        // Articles count
730
        $entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname());
731
        //-------------------------------------
732
        $_entryob_arr = $entrydataHandler->getArticlesAllPermcheck((int)$xoopsModuleConfig['perpage'], $startsub, false, false, 1, null, null, $sortname, $sortorder, null, null, false);
733
        // Get number of articles in the selected condition ($cond)
734
        $numrows = $entrydataHandler->total_getArticlesAllPermcheck;
735
736
        if ($numrows > 0) { // That is, if there ARE unauthorized articles in the system
737
            foreach ($_entryob_arr as $_entryob) {
738
                //get vars
739
                //-------------------------------------
740
                $articles = $_entryob->toArray();
741
                //--------------------
742
                $colname = !empty($_entryob->_sbcolumns) ? $_entryob->_sbcolumns->getVar('name') : '';
743
                $created = $myts->htmlSpecialChars(formatTimestamp($datesub, $xoopsModuleConfig['dateformat']));
744
                $modify  = "<a href='submissions.php?op=mod&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITSUBM . "'></a>";
745
                $delete  = "<a href='submissions.php?op=del&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETESUBM . "'></a>";
746
747
                echo '<tr>';
748
                echo "<td class='head' align='center'>" . $articles['articleID'] . '</td>';
749
                echo "<td class='even' align='left'>" . $colname . '</td>';
750
                echo "<td class='even' align='left'>" . $articles['headline'] . '</td>';
751
                echo "<td class='even' align='center'>" . $created . '</td>';
752
                echo "<td class='even' align='center'>" . $modify . $delete . '</td>';
753
                echo '</tr>';
754
            }
755
        } else { // that is, $numrows = 0, there's no columns yet
756
            echo '<tr>';
757
            echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOSUBMISSYET . '</td>';
758
            echo '</tr>';
759
        }
760
        echo "</table>\n";
761
        $pagenav = new XoopsPageNav($numrows, $xoopsModuleConfig['perpage'], $startsub, 'startsub', '&sortname=' . $sortname . '&sortorder=' . $sortorder);
762
        echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
763
        echo "<br>\n";
764
    }
765
766
    //HACK bydomifara for add method
767

include/functions.php 1 location

@@ 567-649 (lines=83) @@
564
    echo "<br>\n";
565
}
566
567
function showSubmissions()
568
{
569
    global $xoopsGTicket;
570
    global $xoopsModuleConfig, $xoopsModule;
571
572
    $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16);
573
    $myts       = MyTextSanitizer::getInstance();
574
    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
575
    require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
576
    require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
577
    require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php';
578
    $module_id = $xoopsModule->getVar('mid');
579
    $startsub  = isset($_GET['startsub']) ? (int)$_GET['startsub'] : 0;
580
    $datesub   = isset($_GET['datesub']) ? (int)$_GET['datesub'] : 0;
581
582
    //---GET view sort --
583
    $sortname = isset($_GET['sortname']) ? strtolower(trim(strip_tags($myts->stripSlashesGPC($_GET['sortname'])))) : 'datesub';
584
    if (!in_array($sortname, array('datesub', 'weight', 'counter', 'rating', 'headline'))) {
585
        $sortname = 'datesub';
586
    }
587
    $sortorder = isset($_GET['sortorder']) ? strtoupper(trim(strip_tags($myts->stripSlashesGPC($_GET['sortorder'])))) : 'DESC';
588
    if (!in_array($sortorder, array('ASC', 'DESC'))) {
589
        $sortorder = 'DESC';
590
    }
591
    //---------------
592
    /* Code to show submitted articles */
593
    echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWSUBMISSIONS . '</h3>';
594
    echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_SUBTEXT . '</span>';
595
    echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
596
    echo '<tr>';
597
    echo "<td width='40' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTID . '</b></td>';
598
    echo "<td width='20%' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTCOLNAME . '</b></td>';
599
    echo "<td width='45%' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTHEADLINE . '</b></td>';
600
    echo "<td width='90' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTCREATED . '</b></td>';
601
    echo "<td width='60' class='bg3' align='center'><b>" . _AM_SOAPBOX_ACTION . '</b></td>';
602
    echo '</tr>';
603
604
    // Put column names in an array, to avoid a query in the while loop farther ahead
605
    /* Code to show submitted articles */
606
    // Articles count
607
    //    function &getArticlesAllPermcheck(
608
    //         $limit=0, $start=0,
609
    //         $checkRight = true, $published = true, $submit = 0, $offline = 0, $block = null ,
610
    //         $sortname = 'datesub', $sortorder = 'DESC',
611
    //         $select_sbcolumns = null , $NOTarticleIDs = null ,
612
    //         $approve_submit = false ,
613
    //         $id_as_key = false )
614
    // Articles count
615
    $entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname());
616
    //-------------------------------------
617
    $_entryob_arr = $entrydataHandler->getArticlesAllPermcheck((int)$xoopsModuleConfig['perpage'], $startsub, false, false, 1, null, null, $sortname, $sortorder, null, null, false);
618
    // Get number of articles in the selected condition ($cond)
619
    $numrows = $entrydataHandler->total_getArticlesAllPermcheck;
620
621
    if ($numrows > 0) { // That is, if there ARE unauthorized articles in the system
622
        foreach ($_entryob_arr as $_entryob) {
623
            //get vars
624
            //-------------------------------------
625
            $articles = $_entryob->toArray();
626
            //--------------------
627
            $colname = !empty($_entryob->_sbcolumns) ? $_entryob->_sbcolumns->getVar('name') : '';
628
            $created = $myts->htmlSpecialChars(formatTimestamp($datesub, $xoopsModuleConfig['dateformat']));
629
            $modify  = "<a href='submissions.php?op=mod&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITSUBM . "'></a>";
630
            $delete  = "<a href='submissions.php?op=del&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETESUBM . "'></a>";
631
632
            echo '<tr>';
633
            echo "<td class='head' align='center'>" . $articles['articleID'] . '</td>';
634
            echo "<td class='even' align='left'>" . $colname . '</td>';
635
            echo "<td class='even' align='left'>" . $articles['headline'] . '</td>';
636
            echo "<td class='even' align='center'>" . $created . '</td>';
637
            echo "<td class='even' align='center'>" . $modify . $delete . '</td>';
638
            echo '</tr>';
639
        }
640
    } else { // that is, $numrows = 0, there's no columns yet
641
        echo '<tr>';
642
        echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOSUBMISSYET . '</td>';
643
        echo '</tr>';
644
    }
645
    echo "</table>\n";
646
    $pagenav = new XoopsPageNav($numrows, $xoopsModuleConfig['perpage'], $startsub, 'startsub', '&sortname=' . $sortname . '&sortorder=' . $sortorder);
647
    echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
648
    echo "<br>\n";
649
}
650
651
//HACK bydomifara for add method
652
/**