Code Duplication    Length = 18-21 lines in 2 locations

admin/entry.php 2 locations

@@ 388-408 (lines=21) @@
385
                }
386
            }
387
            // trigger Notification only if its a new definition
388
            if(!empty($xoopsModuleConfig['notification_enabled']) ){
389
                global $xoopsModule;
390
                if ($newid == 0) {
391
                    $newid = $xoopsDB->getInsertId();
392
                }
393
                $notification_handler =& xoops_gethandler('notification');
394
                $tags = array();
395
                $shortdefinition = $myts -> htmlSpecialChars(xoops_substr( strip_tags( $definition ),0,45));
396
                $tags['ITEM_NAME'] = $term;
397
                $tags['ITEM_BODY'] = $shortdefinition;
398
                $tags['DATESUB'] = formatTimestamp( $date, 'd M Y' );
399
                $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/entry.php?entryID='. $newid;
400
                $sql = "SELECT name FROM " . $xoopsDB->prefix("lxcategories") . " WHERE categoryID=" . $categoryID;
401
                $result = $xoopsDB->query($sql);
402
                $row = $xoopsDB->fetchArray($result);
403
                $tags['CATEGORY_NAME'] = $row['name'];
404
                $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/category.php?categoryID=' . $categoryID;
405
                $notification_handler->triggerEvent('global', 0, 'new_post', $tags);
406
                $notification_handler->triggerEvent('category', $categoryID, 'new_post', $tags);
407
                //$notification_handler->triggerEvent('term', $newid, 'approve', $tags);
408
            }
409
            lx_calculateTotals();
410
            redirect_header( "entry.php", 1, _AM_LEXIKON_ENTRYCREATEDOK );
411
        } else {
@@ 417-434 (lines=18) @@
414
    } else { // That is, $entryID exists, thus we're editing an entry
415
        if ( $xoopsDB -> query( "UPDATE " . $xoopsDB -> prefix( "lxentries" ) . " SET term = '$term', categoryID = '$categoryID', init = '$init', definition = '$definition', ref = '$ref', url = '$url', uid = '$uid', submit = '$submit', datesub = '$date', html = '$html', smiley = '$smiley', xcodes = '$xcodes', breaks = '$breaks', block = '$block', offline = '$offline', notifypub = '$notifypub', request = '$request' WHERE entryID = '$entryID'" ) ) {
416
            // trigger Notification only if its a new submission
417
            if(!empty($xoopsModuleConfig['notification_enabled']) ){
418
                global $xoopsModule;
419
                $notification_handler =& xoops_gethandler('notification');
420
                $tags = array();
421
                $shortdefinition = $myts -> htmlSpecialChars(xoops_substr( strip_tags( $definition ),0,45));
422
                $tags['ITEM_NAME'] = $term;
423
                $tags['ITEM_BODY'] = $shortdefinition;
424
                $tags['DATESUB'] = formatTimestamp( $date, 'd M Y' );
425
                $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/entry.php?entryID='. $entryID;
426
                $sql = "SELECT name FROM " . $xoopsDB->prefix("lxcategories") . " WHERE categoryID=" . $categoryID;
427
                $result = $xoopsDB->query($sql);
428
                $row = $xoopsDB->fetchArray($result);
429
                $tags['CATEGORY_NAME'] = $row['name'];
430
                $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/category.php?categoryID=' . $categoryID;
431
                $notification_handler->triggerEvent('global', 0, 'new_post', $tags);
432
                $notification_handler->triggerEvent('category', $categoryID, 'new_post', $tags);
433
                $notification_handler->triggerEvent('term', $entryID, 'approve', $tags);
434
            }
435
436
         lx_calculateTotals();
437
            if ($notifypub == '0'){