createSpamCheckTable(); if (isset($_POST['DMDtask']) && is_array($_POST['DMDtask'])) : // IE has a stupid bug: http://www.peterbe.com/plog/button-tag-in-IE. // Here we work around it 🙁 $_POST['DMDtask'] = key($_POST['DMDtask']); elseif (empty($_POST['DMDtask'])) : $_POST['DMDtask'] = ''; endif; $errors = []; $response = ''; $DMDgid = isset($_settings['group_id']) ? $_settings['group_id']['value'] : GroupId::SUBSCRIBERS; if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_params['e']) && $_params['e'] === 'confirm') : $_POST['DMDtask'] = 'confirm'; endif; switch ($_POST['DMDtask']) : case 'subscribe': unset($_POST['id'], $_POST['create_date']); if (isset($_POST['submitCheck']) && !empty($_POST['submitCheck']) ) : $errors[] = "You don't seem to be human!"; endif; $checkErrors = DMD::checkRecipient( $_POST, 'insert', $DMDcid, $pluginLang, RecipientChecker::CHECK_REQUIRED_FORM_FIELDS ); $errors = array_merge($errors, $translateValidationErrors->getTranslatedErrors($checkErrors)); // Make sure forward_id and from_name settings are present: $sql = sprintf( 'SELECT /* dmdelivery_gui plugins-v2/subscribe.php */ SQL_NO_CACHE forward_id, from_name FROM mailing WHERE id = %d', $_settings['confirm_mailing_id']['value'] ); $row = []; $cur = $db->Query($sql) or trigger_error("Query $sql failed: " . $db->Error(), E_USER_ERROR); if (! $db->EndOfResult($cur)) { $db->FetchResultAssoc($cur, $row, 0); } $db->FreeResult($cur); if (!$row['forward_id'] || !$row['from_name']) { $errors[] = sprintf( 'This plugin is not configured properly. The owner of this form should fix this.
The sender address and/or from name are missing for plugin mailing %s.', $pName ); } // Make sure no spamming is going on: $nrSpamCheckRecords = $spamCheck->nrOfRecordsInLast12Hours(new CampaignId($DMDcid), $pName, PH::getRemoteAddr()); if ($nrSpamCheckRecords >= 50) { $errors[] = DMD::pluginWord( 1048 /* In order to prevent abuse of this subscribe procedure, you have to wait a few hours before you can subscribe again. */ ); } if (empty($errors)) : // // Valid data entered, try to add recipient: // // Add recipient to DB, not to group, no overwrite: $recipient = DMD::addRecipient( $DMDcid, null, $_POST, $pName, null, $DMDmid, $pluginLang, RecipientStorer::OVERWRITE_NONE, false ); $DMDrid = $recipient['DMDrid']; if ($recipient['isDuplicate'] && array_key_exists(GroupId::SPAMCOMPLAINT, DMD::getRecipientGroups($DMDcid, $DMDrid)) ) : // If recipient filed a spam complaint in the past, he cannot re-subscribe! $errors[] = DMD::pluginWord(1049 /* Spam-complainers cannot re-subscribe */); else : // Create new MIDRID, as it is used in pluginVars function: $params = ['c' => $DMDcid, 'r' => $DMDrid]; if ($DMDmid) : $params['m'] = $DMDmid; endif; $MIDRID = DMD::DMurlencode($params); if (DMD::recipientAcceptsMail($DMDcid, $DMDrid)) : // Edit data hyperlink: $response = sprintf( '

%s

', DMD::pluginWord( 1052 /* You're a member already. Click to update your personal info */, '/x/plugin/' . htmlspecialchars(DMD::pluginVars('edit_data_request', $pluginLang, false)) ) ); else : // Make recipient a member of the Subscribers group: DMD::addRecipientToGroups($DMDcid, $DMDrid, GroupId::SUBSCRIBERS); if ($recipient['isDuplicate']) : // Update recipient data now (overwrite): $recipient = DMD::addRecipient( $DMDcid, null, $_POST, $pName, $DMDrid, $DMDmid, $pluginLang, RecipientStorer::OVERWRITE_REPLACE_ALL, false ); else : DMD::logRcptAction($DMDcid, $DMDrid, 20, 'gid:' . GroupId::SUBSCRIBERS . " Plugin: {$pName}"); endif; DMD::addToEventBus(new ContactOptIned($DMDcid, $DMDrid, new \DateTime())); $DMDmid = $_settings['welcome_mailing_id']['value']; if ($DMDmid == -1) { list($DMDmid, $DMDsid) = DMD::getLastSentMailing($DMDcid, $pluginLang); } if ($DMDmid) { DMD::sendPluginMailing($DMDcid, $DMDmid, $DMDrid, $pName, $error); } $response = sprintf( '

%s

', DMD::pluginWord(1053 /* You're subscribed */) ); if (!isset($_settings['show_overview']) || $_settings['show_overview']['value'] == 1) : $tableInfo = $recipient['tableInfo']; if (preg_match('/^CRYPT:/', $tableInfo['email']['dbvalue'])) : // Make email readable again (is encrypted): $tableInfo['email']['value'] = $tableInfo['email']['dbvalue'] = $_POST['email']; endif; $response .= DMD::getRecipientInfo( getTableInfoSelection($tableInfo), isset($fieldRowLayout) ? $fieldRowLayout : 'fieldset' ); endif; $spamCheck->addRecord(new CampaignId($DMDcid), $pName, PH::getRemoteAddr()); endif; endif; endif; break; case 'confirm': // Remove recipient from License Bounce exclude list: $sql = sprintf( 'DELETE /* dmdelivery-gui plugins-v2/subscribe.php */ FROM dmd_blacklist WHERE kind = "license hardbounce" AND pattern_type = "email" AND pattern = "%s"', escDBquote($DBfields['email']) ); $db->Query($sql) or trigger_error("Query $sql failed: " . $db->Error(), E_USER_ERROR); if (!empty($_params['cs'])) : $gdprData = array_merge($DBfields, ['wp_gdpr_version' => $_params['cs']]); // Store the consent text version the client should have seen DMD::addRecipient( $DMDcid, null, $gdprData, $pName, $DMDrid, null, $pluginLang, RecipientStorer::OVERWRITE_COMPLEMENT, false ); endif; if (isset($DMDbid)) : // This code is here for the following case: // A subscriber unsubscribes from a mailing (via the unsubscribe plugin) and indicates // he does not want to receive any mail at all (that is: he checks the brand-checkbox), // then the recipient receives a mail with a hyperlink to re-subscribe. // But: the recipient is already on the brand-blacklist... We put him in the unsubscribers // group for all brand-related campaigns (except for the one he's re-subscribing to), and // remove him from the brand-blacklist. // Is the current recipient on the brand-blacklist? $sql = sprintf( 'SELECT /* dmdelivery_gui plugins-v2/subscribe.php */ SQL_NO_CACHE COUNT(*) FROM dmd_blacklist WHERE kind = "brand unsubscribe" AND brand_id = %d AND pattern_type = "email" AND pattern = "%s"', $DMDbid, escDBquote($DBfields['email']) ); $cur = $db->Query($sql) or trigger_error("Query $sql failed: " . $db->Error(), E_USER_ERROR); $brand_unsubscribe_count = $db->FetchResult($cur, 0, 0); $db->FreeResult($cur); if ($brand_unsubscribe_count > 0) { // Search all campaigns connected to the same brand and put the recipient // in the unsubscribers group: $sql = sprintf( 'SELECT /* dmdelivery_gui plugins-v2/subscribe.php instant */ SQL_NO_CACHE id, is_overall FROM campaign WHERE brand_id = %d AND id != %d', $DMDbid, $DMDcid ); $cur = $db->Query($sql) or trigger_error("Query $sql failed: " . $db->Error(), E_USER_ERROR); for ($x = 0; !$db->EndOfResult($cur); $x++) : $l_cid = $db->FetchResult($cur, $x, 'id'); $l_overall = (int)$db->FetchResult($cur, $x, 'is_overall') === 1; $sql = sprintf( 'SELECT /* dmdelivery_gui plugins-v2/subscribe.php */ SQL_NO_CACHE id FROM %s WHERE email = "%s"', ($l_overall ? 'recipient_overall' : "recipient_{$l_cid}"), escDBquote($DBfields['email']) ); $tmp = $db->Query($sql) or trigger_error("Query $sql failed: " . $db->Error(), E_USER_ERROR); if (!$db->EndOfResult($tmp)) : $l_rid = $db->FetchResult($tmp, 0, 'id'); // Put recipient in the 'unsubscribers' group: DMD::addRecipientToGroups($l_cid, $l_rid, GroupId::UNSUBSCRIBERS); // Log it: DMD::logRcptAction( $l_cid, $l_rid, 19, "Plugin: {$pName}" . (isset($mailingName) ? " Mailing: {$mailingName}" : '') ); endif; $db->FreeResult($tmp); endfor; $db->FreeResult($cur); // Delete recipient from brand blacklist: $sql = sprintf( 'DELETE /* dmdelivery-gui plugins-v2/subscribe.php */ FROM dmd_blacklist WHERE kind = "brand unsubscribe" AND brand_id = %d AND pattern_type = "email" AND pattern = "%s"', $DMDbid, escDBquote($DBfields['email']) ); $db->Query($sql) or trigger_error("Query $sql failed: " . $db->Error(), E_USER_ERROR); } endif; $currentRecipientGroups = array_keys(DMD::getRecipientGroups($DMDcid, $DMDrid)); $intersect = array_intersect( [ GroupId::OPT_IN, GroupId::UNSUBSCRIBERS, GroupId::TMP_UNSUBSCRIBERS, GroupId::HARDBOUNCE_1, GroupId::HARDBOUNCE_2, GroupId::HARDBOUNCE_DEF, GroupId::SOFTBOUNCE_1, GroupId::SOFTBOUNCE_2, GroupId::SOFTBOUNCE_DEF, ], $currentRecipientGroups ); if (count($intersect) > 0) { // Delete recipient from group 'opt-in', 'unsubscribers' etc: DMD::deleteRecipientFromGroups($DMDcid, $DMDrid, $intersect); } $alreadySubscribed = DMD::recipientAcceptsMail($DMDcid, $DMDrid); // Add recipient to group 'subscribers': DMD::addRecipientToGroups($DMDcid, $DMDrid, $DMDgid); // Store details: DMD::logRcptAction( $DMDcid, $DMDrid, 18, sprintf( 'Plugin: %s%s%s', $pName, isset($mailingName) ? sprintf(' Mailing: %s', $mailingName) : '', !empty($_params['cs']) ? sprintf(' GDPR: %s', $_params['cs']) : '' ) ); if (!$alreadySubscribed) { $DMDmid = $_settings['welcome_mailing_id']['value']; if ($DMDmid == -1) { list($DMDmid, $DMDsid) = DMD::getLastSentMailing($DMDcid, $pluginLang); } if ($DMDmid) { DMD::sendPluginMailing($DMDcid, $DMDmid, $DMDrid, $pName, $error); } } $tableInfo = DMD::getTableInfo($rcptTable, $pluginLang, true, $DMDrid); if (preg_match('/^CRYPT:/', $tableInfo['email']['dbvalue'])) : unset($tableInfo['email']); endif; $tableInfo = getTableInfoSelection($tableInfo); if (!isset($_settings['show_overview']) || (int)$_settings['show_overview']['value'] === 1) : $response = '

'; $response .= '' . DMD::pluginWord(1056 /* Your subscription has been confirmed */) . ''; $response .= sprintf( '

%s', DMD::pluginWord( 1057 /* If info is incorrect, click link to change it */, '/x/plugin/' . htmlspecialchars(DMD::pluginVars('edit_data', $pluginLang, false)) ) ); $response .= '

'; $response .= DMD::getRecipientInfo($tableInfo, isset($fieldRowLayout) ? $fieldRowLayout : 'fieldset'); else : $response = '

'; $response .= '' . DMD::pluginWord(1056 /* Your subscription has been confirmed */) . ''; $response .= '

'; endif; break; endswitch; ?>
    '; foreach ($errors as $error) : print '
  • ' . $error . '
  • '; endforeach; print '
'; print '

'; elseif (!empty($response)) : print $response; else : ?>

Please don't insert text in the box below!

Scroll to Top

U svibnju i lipnju

Partymania u Minipolisu

MiniPolis je za kraj školske godine pripremio posebne pogodnosti na sve rođendanske pakete u svibnju i lipnju!