| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | $fieldToCheck = []; |
| 50 | 50 | |
| 51 | 51 | foreach ($fields as $key => $field) { |
| 52 | 52 | if (in_array($field, $columnUserTable)) { |
| 53 | - $fieldToCheck[$key] = '`'.$field.'`'; | |
| 53 | + $fieldToCheck[$key] = '`'.acym_secureDBColumn($field).'`'; | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $connection[$element]['where'] = implode(' IS NOT NULL OR ', $fieldToCheck); |
| @@ -200,8 +200,9 @@ | ||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | private function migrateConfig(array $params): int |
| 203 | 203 | { |
| 204 | + //Mail Settings | |
| 204 | 205 | $fieldsMatchMailSettings = [ |
| 205 | 206 | 'add_names' => 'add_names', |
| 206 | 207 | 'bounce_email' => 'bounce_email', |
| 207 | 208 | 'charset' => 'charset', |
| @@ -234,8 +235,9 @@ | ||
| 234 | 235 | 'smtp_username' => 'smtp_username', |
| 235 | 236 | 'special_chars' => 'special_chars', |
| 236 | 237 | ]; |
| 237 | 238 | |
| 239 | + //Queue Process | |
| 238 | 240 | $fieldsMatchQueueProcess = [ |
| 239 | 241 | 'cron_frequency' => 'cron_frequency', |
| 240 | 242 | 'cron_fromip' => 'cron_fromip', |
| 241 | 243 | 'cron_last' => 'cron_last', |
| @@ -249,12 +251,14 @@ | ||
| 249 | 251 | 'queue_try' => 'queue_try', |
| 250 | 252 | 'queue_type' => 'queue_type', |
| 251 | 253 | ]; |
| 252 | 254 | |
| 255 | + //Subscription | |
| 253 | 256 | $fieldsMatchSubscription = [ |
| 254 | 257 | 'require_confirmation' => 'require_confirmation', |
| 255 | 258 | ]; |
| 256 | 259 | |
| 260 | + //Security | |
| 257 | 261 | $fieldsMatchSecurity = [ |
| 258 | 262 | 'allowedfiles' => 'allowed_files', |
| 259 | 263 | 'email_checkdomain' => 'email_checkdomain', |
| 260 | 264 | 'recaptcha_secretkey' => 'recaptcha_secretkey', |
| @@ -265,30 +269,16 @@ | ||
| 265 | 269 | $fieldsMatchNotUsed = [ |
| 266 | 270 | 'allow_visitor' => 'allow_visitor', |
| 267 | 271 | 'confirm_redirect' => 'confirm_redirect', |
| 268 | 272 | 'confirmation_message' => 'confirmation_message', |
| 269 | - 'cron_fullreport' => 'cron_fullreport', | |
| 270 | 273 | 'cron_next' => 'cron_next', |
| 271 | - 'css_backend' => 'css_backend', | |
| 272 | - 'css_frontend' => 'css_frontend', | |
| 273 | - 'forward' => 'forward', | |
| 274 | - 'hostname' => 'hostname', | |
| 275 | - 'notification_accept' => 'notification_accept', | |
| 276 | - 'notification_confirm' => 'notification_confirm', | |
| 277 | - 'notification_created' => 'notification_created', | |
| 278 | - 'notification_refuse' => 'notification_refuse', | |
| 279 | - 'notification_unsuball' => 'notification_unsuball', | |
| 280 | - 'priority_followup' => 'priority_followup', | |
| 281 | 274 | 'priority_newsletter' => 'priority_newsletter', |
| 282 | 275 | 'subscription_message' => 'subscription_message', |
| 283 | 276 | 'unsub_message' => 'unsub_message', |
| 284 | - 'unsub_reasons' => 'unsub_reasons', | |
| 285 | - 'unsub_redirect' => 'unsub_redirect', | |
| 286 | - 'use_sef' => 'use_sef', | |
| 287 | 277 | 'welcome_message' => 'welcome_message', |
| 288 | - 'word_wrapping' => 'word_wrapping', | |
| 289 | 278 | ]; |
| 290 | 279 | |
| 280 | + //Bounce handling | |
| 291 | 281 | $fieldsMatchBounce = [ |
| 292 | 282 | 'bounce_email' => 'bounce_email', |
| 293 | 283 | 'bounce_server' => 'bounce_server', |
| 294 | 284 | 'bounce_port' => 'bounce_port', |
| @@ -590,8 +580,9 @@ | ||
| 590 | 580 | if ('default_value' === $columnConnection[$key] && in_array($oneField->type, ['date', 'birthday'])) { |
| 591 | 581 | $value = preg_replace('@[^0-9]@', '/', $value); |
| 592 | 582 | } |
| 593 | 583 | if ('value' === $columnConnection[$key]) { |
| 584 | + //Decode value from v5 | |
| 594 | 585 | $allValues = explode("\n", $value); |
| 595 | 586 | $returnedValues = []; |
| 596 | 587 | foreach ($allValues as $id => $oneVal) { |
| 597 | 588 | $line = explode('::', trim($oneVal)); |
| @@ -770,16 +761,19 @@ | ||
| 770 | 761 | $fileName = substr($oneAttachment->filename, strrpos($oneAttachment->filename, DS)); |
| 771 | 762 | $uploadFolder = str_replace(['/', '\\'], DS, acym_getFilesFolder()); |
| 772 | 763 | $v7Location = $uploadFolder.$fileName; |
| 773 | 764 | |
| 765 | + // if the file doesn't exist, don't add it | |
| 774 | 766 | $v5Path = acym_cleanPath(ACYM_ROOT.DS.$oneAttachment->filename); |
| 775 | 767 | if (!file_exists($v5Path)) continue; |
| 776 | 768 | |
| 769 | + // copy the file to the v7 files location | |
| 777 | 770 | $v7Path = acym_cleanPath(ACYM_ROOT.DS.$v7Location); |
| 778 | 771 | if (!file_exists($v7Path)) { |
| 779 | 772 | acym_copyFile($v5Path, $v7Path); |
| 780 | 773 | } |
| 781 | 774 | |
| 775 | + // add the attachment to the new mail entry | |
| 782 | 776 | $mail['attachments'][] = (object)[ |
| 783 | 777 | 'filename' => $v7Location, |
| 784 | 778 | 'size' => $oneAttachment->size, |
| 785 | 779 | ]; |
| @@ -786,8 +780,9 @@ | ||
| 786 | 780 | } |
| 787 | 781 | } |
| 788 | 782 | $mail['attachments'] = acym_escapeDB(json_encode($mail['attachments'])); |
| 789 | 783 | |
| 784 | + // Create the related campaign | |
| 790 | 785 | if ($mailType === MailClass::TYPE_STANDARD) { |
| 791 | 786 | $stats = acym_loadResult('SELECT COUNT(mailid) FROM #__acymailing_stats WHERE mailid = '.intval($oneMail->mailid)); |
| 792 | 787 | $isSent = !empty($stats); |
| 793 | 788 | |
| @@ -803,8 +798,9 @@ | ||
| 803 | 798 | ]; |
| 804 | 799 | $campaignsToInsert[] = '('.implode(', ', $campaign).')'; |
| 805 | 800 | } |
| 806 | 801 | |
| 802 | + // Create the related follow-up | |
| 807 | 803 | if ($mailType === MailClass::TYPE_FOLLOWUP) { |
| 808 | 804 | $v5Campaign = acym_loadObject( |
| 809 | 805 | 'SELECT l.listid, l.published, l.name |
| 810 | 806 | FROM #__acymailing_listmail AS lm |
| @@ -811,8 +807,9 @@ | ||
| 811 | 807 | JOIN #__acymailing_list AS l ON l.listid = lm.listid |
| 812 | 808 | WHERE mailid = '.intval($oneMail->mailid) |
| 813 | 809 | ); |
| 814 | 810 | |
| 811 | + // If the followup campaign doesn't exist, create it | |
| 815 | 812 | if (empty($followupsCreated[$v5Campaign->listid])) { |
| 816 | 813 | $followupListIds = acym_loadResultArray('SELECT listid FROM #__acymailing_listcampaign WHERE campaignid = '.intval($v5Campaign->listid)); |
| 817 | 814 | $followupCampaign = new \stdClass(); |
| 818 | 815 | $followupCampaign->name = $v5Campaign->name; |
| @@ -1001,9 +998,8 @@ | ||
| 1001 | 998 | ]; |
| 1002 | 999 | |
| 1003 | 1000 | $migratedRules = []; |
| 1004 | 1001 | foreach ($rules as $oneRule) { |
| 1005 | - | |
| 1006 | 1002 | $actionUser = unserialize($oneRule->action_user); |
| 1007 | 1003 | $actionMessage = unserialize($oneRule->action_message); |
| 1008 | 1004 | |
| 1009 | 1005 | $actionsOnUsers = []; |
| @@ -1072,9 +1068,9 @@ | ||
| 1072 | 1068 | } |
| 1073 | 1069 | |
| 1074 | 1070 | $mailboxClass = new MailboxClass(); |
| 1075 | 1071 | $listClass = new ListClass(); |
| 1076 | - $standardLists = array_column($listClass->getAllWithoutManagement(), 'id');; | |
| 1072 | + $standardLists = array_column($listClass->getAllWithoutManagement(), 'id'); | |
| 1077 | 1073 | $groups = acym_getGroups(); |
| 1078 | 1074 | foreach ($distributionLists as $oneDistributionList) { |
| 1079 | 1075 | $mailboxAction = new \stdClass(); |
| 1080 | 1076 | $mailboxAction->name = $oneDistributionList->name; |
| @@ -1277,9 +1273,9 @@ | ||
| 1277 | 1273 | $stat = [ |
| 1278 | 1274 | 'mail_id' => acym_escapeDB($oneStat->mailid), |
| 1279 | 1275 | 'total_subscribers' => acym_escapeDB($totalSent + $oneStat->fail), |
| 1280 | 1276 | 'sent' => acym_escapeDB($totalSent), |
| 1281 | - 'send_date' => empty($oneStat->senddate) ? 'NULL' : acym_escapeDB(acym_date($oneStat->senddate, 'Y-m-d H:i:s')), | |
| 1277 | + 'send_date' => empty($oneStat->senddate) ? 'NULL' : acym_escapeDB(acym_date($oneStat->senddate, 'Y-m-d H:i:s', false)), | |
| 1282 | 1278 | 'fail' => acym_escapeDB($oneStat->fail), |
| 1283 | 1279 | 'open_unique' => intval($oneStat->openunique), |
| 1284 | 1280 | 'open_total' => intval($oneStat->opentotal), |
| 1285 | 1281 | ]; |
| @@ -1411,8 +1407,9 @@ | ||
| 1411 | 1407 | 'DELETE FROM #__acym_user_stat', |
| 1412 | 1408 | 'DELETE FROM #__acym_url_click', |
| 1413 | 1409 | 'DELETE FROM #__acym_mail_stat', |
| 1414 | 1410 | 'DELETE FROM #__acym_mail', |
| 1411 | + 'UPDATE #__acym_configuration SET `value` = 0 WHERE `name` = "favorite_template"', | |
| 1415 | 1412 | ]; |
| 1416 | 1413 | |
| 1417 | 1414 | return $this->finalizeClean($queryClean); |
| 1418 | 1415 | } |