Code Duplication    Length = 38-39 lines in 2 locations

ro_regonlinehandler.php 2 locations

@@ 967-1005 (lines=39) @@
964
            $query    .= " WHERE (((ron_eventid)=$eventid))";
965
            $res      = $GLOBALS['xoopsDB']->query($query);
966
            $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
967
            if ($num_rows == 0) {
968
                //nothing to do
969
            } else {
970
                while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
971
                    $xoopsMailer = xoops_getMailer();
972
                    $xoopsMailer->useMail();
973
                    //set template path
974
                    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
975
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
976
                    } else {
977
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
978
                    }
979
                    //set template name
980
                    $xoopsMailer->setTemplate('ro_notify_in.tpl');
981
                    //set sender
982
                    $xoopsMailer->setFromEmail($cal->ro_mail_sender);
983
                    //set name of sender
984
                    $xoopsMailer->setFromName($cal->ro_mail_sendername);
985
                    //set subject
986
                    $subject = _APCAL_RO_MAIL_SUBJ_ADD;
987
                    $xoopsMailer->setSubject($subject);
988
                    //assign vars in template
989
                    $xoopsMailer->assign('UNAME', $uname);
990
                    $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
991
                    $xoopsMailer->assign('SUMMARY', $summary);
992
                    $xoopsMailer->assign('DATE', $date);
993
                    $xoopsMailer->assign('LOCATION', $location);
994
                    $xoopsMailer->assign('WAITINGLIST', $waitinglist_used2);
995
                    $xoopsMailer->assign('URL', $eventurl);
996
                    $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
997
                    //set recipient
998
                    $recipient = $member->ron_email;
999
                    $xoopsMailer->setToEmails($recipient);
1000
1001
                    //execute sending
1002
                    $xoopsMailer->send();
1003
                    $xoopsMailer->reset();
1004
                }
1005
            }
1006
1007
            //confirmation mail to registered person
1008
            if ($confirmto == '-') {
@@ 1172-1209 (lines=38) @@
1169
1170
            $res      = $GLOBALS['xoopsDB']->query($query);
1171
            $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
1172
            if ($num_rows == 0) {
1173
                //nothing to do
1174
            } else {
1175
                while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
1176
                    $xoopsMailer = xoops_getMailer();
1177
                    $xoopsMailer->useMail();
1178
                    //set template path
1179
                    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
1180
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
1181
                    } else {
1182
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1183
                    }
1184
                    //set template name
1185
                    $xoopsMailer->setTemplate('ro_notify_out.tpl');
1186
                    //set sender
1187
                    $xoopsMailer->setFromEmail($cal->ro_mail_sender);
1188
                    //set sender name
1189
                    $xoopsMailer->setFromName($cal->ro_mail_sendername);
1190
                    //set subject
1191
                    $subject = _APCAL_RO_MAIL_SUBJ_REMOVE;
1192
                    $xoopsMailer->setSubject($subject);
1193
                    //assign vars
1194
                    $xoopsMailer->assign('UNAME', $uname);
1195
                    $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
1196
                    $xoopsMailer->assign('SUMMARY', $summary);
1197
                    $xoopsMailer->assign('DATE', $date);
1198
                    $xoopsMailer->assign('LOCATION', $location);
1199
                    $xoopsMailer->assign('URL', $eventurl);
1200
                    $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
1201
                    //set recipient
1202
                    $recipient = $member->ron_email;
1203
                    $xoopsMailer->setToEmails($recipient);
1204
1205
                    //execute sending
1206
                    $xoopsMailer->send();
1207
                    $xoopsMailer->reset();
1208
                }
1209
            }
1210
1211
            //confirmation mail to registered person
1212
            if ($confirmto == '-') {