|
212 | 212 | if (isset($_GET['duplicate'])) { |
213 | 213 | verifyCsrfGetToken(); |
214 | 214 |
|
| 215 | + $idToDuplicate = sprintf('%d', $_GET['duplicate']); |
| 216 | + $action_result .= $GLOBALS['I18N']->get('Copying')." $idToDuplicate .."; |
215 | 217 | Sql_Query(sprintf('insert into %s (uuid, subject, fromfield, tofield, replyto, message, textmessage, footer, entered, |
216 | 218 | modified, embargo, repeatuntil, repeatinterval, requeueinterval, status, htmlformatted, sendformat, template, rsstemplate, owner) |
217 | 219 | select "%s", subject, fromfield, tofield, replyto, message, textmessage, footer, now(), |
218 | 220 | now(), now(), now(), repeatinterval, requeueinterval, "draft", htmlformatted, |
219 | 221 | sendformat, template, rsstemplate, "%d" from %s |
220 | 222 | where id = %d', |
221 | 223 | $GLOBALS['tables']['message'], (string) Uuid::generate(4), $_SESSION['logindetails']['id'],$GLOBALS['tables']['message'], |
222 | | - intval($_GET['duplicate']))); |
| 224 | + $idToDuplicate)); |
223 | 225 | if ($newId = Sql_Insert_Id()) { // if we don't have a newId then the copy failed |
224 | 226 | Sql_Query(sprintf('insert into %s (id,name,data) '. |
225 | 227 | 'select %d,name,data from %s where name in ("sendmethod","sendurl","campaigntitle","excludelist","subject") and id = %d', |
226 | | - $GLOBALS['tables']['messagedata'],$newId,$GLOBALS['tables']['messagedata'],intval($_GET['duplicate']))); |
| 228 | + $GLOBALS['tables']['messagedata'],$newId,$GLOBALS['tables']['messagedata'],$idToDuplicate)); |
227 | 229 | Sql_Query(sprintf('insert into %s (messageid, listid, entered) select %d, listid, now() from %s where messageid = %d', |
228 | | - $GLOBALS['tables']['listmessage'],$newId,$GLOBALS['tables']['listmessage'],intval($_GET['duplicate']))); |
| 230 | + $GLOBALS['tables']['listmessage'],$newId,$GLOBALS['tables']['listmessage'],$idToDuplicate)); |
| 231 | + $action_result .= '... '.$GLOBALS['I18N']->get('Done'); |
| 232 | + } else { |
| 233 | + $action_result .= '... '.$GLOBALS['I18N']->get('failed'); |
229 | 234 | } |
230 | | - |
231 | 235 | } |
232 | 236 |
|
233 | 237 | if (isset($_GET['resend'])) { |
|
0 commit comments