]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/order_filter.php
Updated copyright year.
[mailer.git] / inc / filter / order_filter.php
index f8866822d65468c94ab047ae08315003444fa83b..f7515cdd3f198e2fb03d50efca77acfc5c8f369a 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -123,5 +123,103 @@ function FILTER_ORDER_POINTS_COLUMNS ($filterData) {
        return $filterData;
 }
 
+// Filter for generic check of subject line
+function FILTER_MAIL_ORDER_GENERIC_CHECK_SUBJECT ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Shall I test the subject line against URLs?
+       if (!isAllowUrlInSubjectEnabled()) {
+               // @TODO 200 is hard-coded here, swap it out to config + admin_config_order.tpl
+               $filterData['subject'] = str_replace(chr(92), '[nl]', substr($filterData['subject'], 0, 200));
+
+               // Check the subject line for unwanted things
+               if ((isInStringIgnoreCase('https://', $filterData['subject'])) || (isInStringIgnoreCase('http://', $filterData['subject'])) || (isInStringIgnoreCase('www', $filterData['subject']))) {
+                       // URL in subject found
+                       $filterData['redirect'] = 'modules.php?module=login&what=order&code=' . getCode('SUBJECT_URL');
+                       interruptFilterChain();
+               } // END - if
+       } // END - if
+
+       // Return the data for next filter
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
+// Filter for generic check of mail text
+function FILTER_MAIL_ORDER_GENERIC_CHECK_TEXT ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       if (!isAllowUrlInTextEnabled()) {
+               // Test submitted text against some filters (length, URLs in text etc.)
+               if ((isInStringIgnoreCase('https://', $filterData['text'])) || (isInStringIgnoreCase('http://', $filterData['text'])) || (isInStringIgnoreCase('www', $filterData['text']))) {
+                       // URL found
+                       $filterData['redirect'] = 'modules.php?module=login&what=order&code=' . getCode('URL_FOUND');
+                       interruptFilterChain();
+               } // END - if
+
+               // Remove new-line and carriage-return characters
+               $TEST = str_replace(array(PHP_EOL, chr(13)), array('', ''), $filterData['text']);
+
+               // Text length within allowed length?
+               if (strlen($TEST) > getMaxTextLength()) {
+                       // Text is too long!
+                       $filterData['redirect'] = 'modules.php?module=login&what=order&code=' . getCode('OVERLENGTH');
+                       interruptFilterChain();
+               } // END - if
+       } // END - if
+
+       // Return the data for next filter
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
+// Filter for generic check of mail type
+function FILTER_MAIL_ORDER_GENERIC_CHECK_TYPE ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Is mail type set?
+       if ((!isset($filterData['mail_type'])) || ($filterData['mail_type'] < 1)) {
+               // Not correctly set
+               $filterData['redirect'] = 'modules.php?module=login&amp;what=order&amp;code=' . getCode('NO_MAIL_TYPE');
+               interruptFilterChain();
+       } // END - if
+
+       // Return the data for next filter
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
+// Filter for generic check of URL
+function FILTER_MAIL_ORDER_GENERIC_CHECK_URL ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Validate URL
+       if (!isUrlValid($filterData['url'])) {
+               // URL is invalid!
+               $filterData['redirect'] = 'modules.php?module=login&amp;what=order&amp;code=' . getCode('INVALID_URL');
+               interruptFilterChain();
+       } // END - if
+
+       // Return the data for next filter
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
+// Filter for generic check of receiver amount
+function FILTER_MAIL_ORDER_GENERIC_CHECK_RECEIVER ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+
+       // Enougth receivers entered?
+       if (($filterData['receiver'] < getOrderMin()) && (!isAdmin())) {
+               // Less than allowed receivers entered!
+               $filterData['redirect'] = 'modules.php?module=login&amp;what=order&amp;code=' . getCode('MORE_RECEIVERS3');
+               interruptFilterChain();
+       } // END - if
+
+       // Return the data for next filter
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
 // [EOF]
 ?>