Code Duplication    Length = 34-36 lines in 3 locations

admin/modify_ads.php 1 location

@@ 375-410 (lines=36) @@
372
 * @param  string $photo
373
 * @return void
374
 */
375
function ListingDel($lid, $photo)
376
{
377
    global $xoopsDB, $moduleDirName, $admin_lang;
378
379
    $lid = (int)$lid;
380
381
    $result2 = $xoopsDB->query('SELECT p.url FROM '
382
                               . $xoopsDB->prefix('adslight_listing')
383
                               . ' l LEFT JOIN '
384
                               . $xoopsDB->prefix('adslight_pictures')
385
                               . ' p  ON l.lid=p.lid WHERE l.lid='
386
                               . $xoopsDB->escape($lid)
387
                               . '');
388
389
    while (list($purl) = $xoopsDB->fetchRow($result2)) {
390
        if ($purl) {
391
            $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight';
392
            if (file_exists("$destination/$purl")) {
393
                unlink("$destination/$purl");
394
            }
395
            $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs';
396
            if (file_exists("$destination2/thumb_$purl")) {
397
                unlink("$destination2/thumb_$purl");
398
            }
399
            $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize';
400
            if (file_exists("$destination3/resized_$purl")) {
401
                unlink("$destination3/resized_$purl");
402
            }
403
            $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . " WHERE lid={$lid}");
404
        }
405
    }
406
407
    $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}");
408
409
    redirect_header('modify_ads.php', 1, _AM_ADSLIGHT_ANNDEL);
410
}
411
412
#####################################################
413
#####################################################

admin/validate_ads.php 1 location

@@ 643-676 (lines=34) @@
640
 * @param $lid
641
 * @param $photo
642
 */
643
function ListingDel($lid, $photo)
644
{
645
    global $xoopsDB, $moduleDirName, $admin_lang;
646
647
    $result2 = $xoopsDB->query('SELECT p.url FROM '
648
                               . $xoopsDB->prefix('adslight_listing')
649
                               . ' l LEFT JOIN '
650
                               . $xoopsDB->prefix('adslight_pictures')
651
                               . ' p  ON l.lid=p.lid WHERE l.lid='
652
                               . $xoopsDB->escape($lid)
653
                               . '');
654
655
    while (list($purl) = $xoopsDB->fetchRow($result2)) {
656
        if ($purl) {
657
            $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight';
658
            if (file_exists("$destination/$purl")) {
659
                unlink("$destination/$purl");
660
            }
661
            $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs';
662
            if (file_exists("$destination2/thumb_$purl")) {
663
                unlink("$destination2/thumb_$purl");
664
            }
665
            $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize';
666
            if (file_exists("$destination3/resized_$purl")) {
667
                unlink("$destination3/resized_$purl");
668
            }
669
            $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . " WHERE lid=$lid");
670
        }
671
    }
672
673
    $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid=$lid");
674
675
    redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNDEL);
676
}
677
678
#  function ListingValid
679
#####################################################

admin/view_ads.php 1 location

@@ 615-648 (lines=34) @@
612
 * @param $lid
613
 * @param $photo
614
 */
615
function ListingDel($lid, $photo)
616
{
617
    global $xoopsDB, $moduleDirName, $admin_lang;
618
619
    $result2 = $xoopsDB->query('SELECT p.url FROM '
620
                               . $xoopsDB->prefix('adslight_listing')
621
                               . ' l LEFT JOIN '
622
                               . $xoopsDB->prefix('adslight_pictures')
623
                               . ' p  ON l.lid=p.lid WHERE l.lid='
624
                               . $xoopsDB->escape($lid)
625
                               . '');
626
627
    while (list($purl) = $xoopsDB->fetchRow($result2)) {
628
        if ($purl) {
629
            $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight';
630
            if (file_exists("$destination/$purl")) {
631
                unlink("$destination/$purl");
632
            }
633
            $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs';
634
            if (file_exists("$destination2/thumb_$purl")) {
635
                unlink("$destination2/thumb_$purl");
636
            }
637
            $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize';
638
            if (file_exists("$destination3/resized_$purl")) {
639
                unlink("$destination3/resized_$purl");
640
            }
641
            $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . " WHERE lid=$lid");
642
        }
643
    }
644
645
    $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid=$lid");
646
647
    redirect_header('view_ads.php', 1, _AM_ADSLIGHT_ANNDEL);
648
}
649
650
#  function ListingValid
651
#####################################################