Code Duplication    Length = 102-102 lines in 2 locations

admin/validate_ads.php 1 location

@@ 702-803 (lines=102) @@
699
 * @param $valid
700
 * @param $photo
701
 */
702
function listingValid(
703
    $lid,
704
    $cat,
705
    $title,
706
    $status,
707
    $expire,
708
    $type,
709
    $desctext,
710
    $tel,
711
    $price,
712
    $typeprice,
713
    $typeusure,
714
    $date,
715
    $email,
716
    $submitter,
717
    $town,
718
    $country,
719
    $contactby,
720
    $premium,
721
    $valid,
722
    $photo
723
) {
724
    global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang;
725
726
    $title     = $myts->htmlSpecialChars($title);
727
    $status    = $myts->htmlSpecialChars($status);
728
    $expire    = $myts->htmlSpecialChars($expire);
729
    $type      = $myts->htmlSpecialChars($type);
730
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
731
    $tel       = $myts->htmlSpecialChars($tel);
732
    $price     = str_replace(array(' '), '', $price);
733
    $typeprice = $myts->htmlSpecialChars($typeprice);
734
    $typeusure = $myts->htmlSpecialChars($typeusure);
735
    $submitter = $myts->htmlSpecialChars($submitter);
736
    $town      = $myts->htmlSpecialChars($town);
737
    $country   = $myts->htmlSpecialChars($country);
738
    $contactby = $myts->htmlSpecialChars($contactby);
739
    $premium   = $myts->htmlSpecialChars($premium);
740
    $now       = time();
741
    $xoopsDB->query('UPDATE '
742
                    . $xoopsDB->prefix('adslight_listing')
743
                    . " SET cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$now', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' WHERE lid=$lid");
744
745
    if ($email == '') {
746
    } else {
747
        $tags               = array();
748
        $tags['TITLE']      = $title;
749
        $tags['TYPE']       = AdslightUtilities::getNameType($type);
750
        $tags['SUBMITTER']  = $submitter;
751
        $tags['DESCTEXT']   = stripslashes($desctext);
752
        $tags['EMAIL']      = _AM_ADSLIGHT_EMAIL;
753
        $tags['TEL']        = _AM_ADSLIGHT_TEL;
754
        $tags['HELLO']      = _AM_ADSLIGHT_HELLO;
755
        $tags['VEDIT_AD']   = _AM_ADSLIGHT_VEDIT_AD;
756
        $tags['ANNACCEPT']  = _AM_ADSLIGHT_ANNACCEPT;
757
        $tags['CONSULTTO']  = _AM_ADSLIGHT_CONSULTTO;
758
        $tags['THANKS']     = _ADSLIGHT_THANKS;
759
        $tags['TEAMOF']     = _AM_ADSLIGHT_TEAMOF;
760
        $tags['META_TITLE'] = $meta['title'];
761
        $tags['LINK_URL']   = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewads.php?lid=' . $lid . '';
762
        $tags['YOUR_AD']    = _AM_ADSLIGHT_YOUR_AD;
763
        $tags['WEBMASTER']  = _AM_ADSLIGHT_WEBMASTER;
764
        $tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON;
765
        $tags['APPROVED']   = _AM_ADSLIGHT_APPROVED;
766
767
        $subject = '' . _AM_ADSLIGHT_ANNACCEPT . '';
768
        $mail    =& getMailer();
769
        $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
770
        $mail->setTemplate('listing_approve.tpl');
771
        $mail->useMail();
772
        $mail->multimailer->isHTML(true);
773
        $mail->setFromName($meta['title']);
774
        $mail->setFromEmail($xoopsConfig['adminmail']);
775
        $mail->setToEmails($email);
776
        $mail->setSubject($subject);
777
        $mail->assign($tags);
778
        $mail->send();
779
        echo $mail->getErrors();
780
    }
781
782
    $tags                    = array();
783
    $tags['TITLE']           = $title;
784
    $tags['ADDED_TO_CAT']    = _AM_ADSLIGHT_ADDED_TO_CAT;
785
    $tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF;
786
    $tags['ERROR_NOTIF']     = _AM_ADSLIGHT_ERROR_NOTIF;
787
    $tags['WEBMASTER']       = _AM_ADSLIGHT_WEBMASTER;
788
    $tags['HELLO']           = _AM_ADSLIGHT_HELLO;
789
    $tags['FOLLOW_LINK']     = _AM_ADSLIGHT_FOLLOW_LINK;
790
    $tags['TYPE']            = AdslightUtilities::getNameType($type);
791
    $tags['LINK_URL']        = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid;
792
    $sql                     = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cat);
793
    $result                  = $xoopsDB->query($sql);
794
    $row                     = $xoopsDB->fetchArray($result);
795
    $tags['CATEGORY_TITLE']  = $row['title'];
796
    $tags['CATEGORY_URL']    = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cat);
797
    $notification_handler    = xoops_getHandler('notification');
798
    $notification_handler->triggerEvent('global', 0, 'new_listing', $tags);
799
    $notification_handler->triggerEvent('category', $cat, 'new_listing', $tags);
800
    $notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags);
801
802
    redirect_header('validate_ads.php', 3, _AM_ADSLIGHT_ANNVALID);
803
}
804
805
#####################################################
806
#####################################################

admin/view_ads.php 1 location

@@ 674-775 (lines=102) @@
671
 * @param $valid
672
 * @param $photo
673
 */
674
function listingValid(
675
    $lid,
676
    $cat,
677
    $title,
678
    $status,
679
    $expire,
680
    $type,
681
    $desctext,
682
    $tel,
683
    $price,
684
    $typeprice,
685
    $typeusure,
686
    $date,
687
    $email,
688
    $submitter,
689
    $town,
690
    $country,
691
    $contactby,
692
    $premium,
693
    $valid,
694
    $photo
695
) {
696
    global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang;
697
698
    $title     = $myts->htmlSpecialChars($title);
699
    $status    = $myts->htmlSpecialChars($status);
700
    $expire    = $myts->htmlSpecialChars($expire);
701
    $type      = $myts->htmlSpecialChars($type);
702
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
703
    $tel       = $myts->htmlSpecialChars($tel);
704
    $price     = str_replace(array(' '), '', $price);
705
    $typeprice = $myts->htmlSpecialChars($typeprice);
706
    $typeusure = $myts->htmlSpecialChars($typeusure);
707
    $submitter = $myts->htmlSpecialChars($submitter);
708
    $town      = $myts->htmlSpecialChars($town);
709
    $country   = $myts->htmlSpecialChars($country);
710
    $contactby = $myts->htmlSpecialChars($contactby);
711
    $premium   = $myts->htmlSpecialChars($premium);
712
    $now       = time();
713
    $xoopsDB->query('UPDATE '
714
                    . $xoopsDB->prefix('adslight_listing')
715
                    . " SET cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$now', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' WHERE lid=$lid");
716
717
    if ($email == '') {
718
    } else {
719
        $tags               = array();
720
        $tags['TITLE']      = $title;
721
        $tags['TYPE']       = AdslightUtilities::getNameType($type);
722
        $tags['SUBMITTER']  = $submitter;
723
        $tags['DESCTEXT']   = stripslashes($desctext);
724
        $tags['EMAIL']      = _AM_ADSLIGHT_EMAIL;
725
        $tags['TEL']        = _AM_ADSLIGHT_TEL;
726
        $tags['HELLO']      = _AM_ADSLIGHT_HELLO;
727
        $tags['VEDIT_AD']   = _AM_ADSLIGHT_VEDIT_AD;
728
        $tags['ANNACCEPT']  = _AM_ADSLIGHT_ANNACCEPT;
729
        $tags['CONSULTTO']  = _AM_ADSLIGHT_CONSULTTO;
730
        $tags['THANKS']     = _ADSLIGHT_THANKS;
731
        $tags['TEAMOF']     = _AM_ADSLIGHT_TEAMOF;
732
        $tags['META_TITLE'] = $meta['title'];
733
        $tags['LINK_URL']   = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewads.php?lid=' . $lid . '';
734
        $tags['YOUR_AD']    = _AM_ADSLIGHT_YOUR_AD;
735
        $tags['WEBMASTER']  = _AM_ADSLIGHT_WEBMASTER;
736
        $tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON;
737
        $tags['APPROVED']   = _AM_ADSLIGHT_APPROVED;
738
739
        $subject = '' . _AM_ADSLIGHT_ANNACCEPT . '';
740
        $mail    =& getMailer();
741
        $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
742
        $mail->setTemplate('listing_approve.tpl');
743
        $mail->useMail();
744
        $mail->multimailer->isHTML(true);
745
        $mail->setFromName($meta['title']);
746
        $mail->setFromEmail($xoopsConfig['adminmail']);
747
        $mail->setToEmails($email);
748
        $mail->setSubject($subject);
749
        $mail->assign($tags);
750
        $mail->send();
751
        echo $mail->getErrors();
752
    }
753
754
    $tags                    = array();
755
    $tags['TITLE']           = $title;
756
    $tags['ADDED_TO_CAT']    = _AM_ADSLIGHT_ADDED_TO_CAT;
757
    $tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF;
758
    $tags['ERROR_NOTIF']     = _AM_ADSLIGHT_ERROR_NOTIF;
759
    $tags['WEBMASTER']       = _AM_ADSLIGHT_WEBMASTER;
760
    $tags['HELLO']           = _AM_ADSLIGHT_HELLO;
761
    $tags['FOLLOW_LINK']     = _AM_ADSLIGHT_FOLLOW_LINK;
762
    $tags['TYPE']            = AdslightUtilities::getNameType($type);
763
    $tags['LINK_URL']        = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid;
764
    $sql                     = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cat);
765
    $result                  = $xoopsDB->query($sql);
766
    $row                     = $xoopsDB->fetchArray($result);
767
    $tags['CATEGORY_TITLE']  = $row['title'];
768
    $tags['CATEGORY_URL']    = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cat);
769
    $notification_handler    = xoops_getHandler('notification');
770
    $notification_handler->triggerEvent('global', 0, 'new_listing', $tags);
771
    $notification_handler->triggerEvent('category', $cat, 'new_listing', $tags);
772
    $notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags);
773
774
    redirect_header('view_ads.php', 3, _AM_ADSLIGHT_ANNVALID);
775
}
776
777
#####################################################
778
#####################################################