Code Duplication    Length = 16-16 lines in 3 locations

index.php 3 locations

@@ 158-173 (lines=16) @@
155
    $resultS = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND submit = '1' AND offline = '1' AND request = '0' ORDER BY term" );
156
    $totalSwords = $xoopsDB -> getRowsNum ( $resultS );
157
158
    if ( $totalSwords > 0 ) // If there are definitions
159
    {
160
        while (list( $entryID, $term ) = $xoopsDB->fetchRow($resultS)) {
161
            $subentries = array();
162
            $xoopsModule = XoopsModule::getByDirname("lexikon");
163
            $linktext = ucfirst($myts -> htmlSpecialChars( $term ));
164
            $subentries['linktext'] = $linktext;
165
            $subentries['id'] = $entryID;
166
167
            $blockS['substuff'][] = $subentries;
168
        }
169
        $xoopsTpl -> assign( 'blockS', $blockS);
170
        $xoopsTpl -> assign ( 'wehavesubs', 1 );
171
    } else {
172
        $xoopsTpl -> assign ( 'wehavesubs', 0 );
173
    }
174
175
    $blockR = array();
176
    $resultR = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND request = '1' ORDER BY term" );
@@ 179-194 (lines=16) @@
176
    $resultR = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND request = '1' ORDER BY term" );
177
    $totalRwords = $xoopsDB -> getRowsNum ( $resultR );
178
179
    if ( $totalRwords > 0 ) // If there are definitions
180
    {
181
        while (list( $entryID, $term ) = $xoopsDB->fetchRow($resultR)) {
182
            $reqentries = array();
183
            $xoopsModule = XoopsModule::getByDirname("lexikon");
184
            $linktext = ucfirst($myts -> htmlSpecialChars( $term ));
185
            $reqentries['linktext'] = $linktext;
186
            $reqentries['id'] = $entryID;
187
188
            $blockR['reqstuff'][] = $reqentries;
189
        }
190
        $xoopsTpl -> assign( 'blockR', $blockR);
191
        $xoopsTpl -> assign ( 'wehavereqs', 1 );
192
    } else {
193
        $xoopsTpl -> assign ( 'wehavereqs', 0 );
194
    }
195
196
} else {
197
    $xoopsTpl -> assign ('userisadmin', 0 );
@@ 202-217 (lines=16) @@
199
    $resultR = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND request = '1' ".$catperms." ORDER BY term" );
200
    $totalRwords = $xoopsDB -> getRowsNum ( $resultR );
201
202
    if ( $totalRwords > 0 ) // If there are definitions
203
    {
204
        while (list( $entryID, $term ) = $xoopsDB->fetchRow($resultR)) {
205
            $reqentries = array();
206
            $xoopsModule = XoopsModule::getByDirname("lexikon");
207
            $linktext = ucfirst($myts -> htmlSpecialChars( $term ));
208
            $reqentries['linktext'] = $linktext;
209
            $reqentries['id'] = $entryID;
210
211
            $blockR['reqstuff'][] = $reqentries;
212
        }
213
        $xoopsTpl -> assign( 'blockR', $blockR);
214
        $xoopsTpl -> assign ( 'wehavereqs', 1 );
215
    } else {
216
        $xoopsTpl -> assign ( 'wehavereqs', 0 );
217
    }
218
219
}
220
// Various strings