]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-list_coupon.php
Rewrites to use filters instead of mass if() blocks
[mailer.git] / inc / modules / member / what-list_coupon.php
index aa364d47a499d647a4be7fb395f0624f85f61b1d..d315464f2a46369c8d6bf87151e6d001728dc48b 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -37,7 +37,7 @@
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       die();
+       exit();
 } elseif (!isMember()) {
        redirectToIndexMemberOnlyModule();
 }
@@ -53,28 +53,28 @@ if ((!isExtensionActive('coupon')) && (!isAdmin())) {
 
 // Check if the user has cashed coupons
 $result = SQL_QUERY_ESC("SELECT
-       UNIX_TIMESTAMP(u.`cashed_on`) AS `cashed_on`,
-       UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`,
-       UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`,
-       d.`points`,
-       d.`total_created`,
-       d.`total_cashed`,
-       d.`coupon_description`
+       UNIX_TIMESTAMP(`u`.`cashed_on`) AS `cashed_on`,
+       UNIX_TIMESTAMP(`d`.`coupon_created`) AS `coupon_created`,
+       UNIX_TIMESTAMP(`d`.`coupon_expired`) AS `coupon_expired`,
+       `d`.`points`,
+       `d`.`total_created`,
+       `d`.`total_cashed`,
+       `d`.`coupon_description`
 FROM
-       `{?_MYSQL_PREFIX?}_user_coupons` AS u
+       `{?_MYSQL_PREFIX?}_user_coupons` AS `u`
 INNER JOIN
-       `{?_MYSQL_PREFIX?}_coupon_data` AS d
+       `{?_MYSQL_PREFIX?}_coupon_data` AS `d`
 ON
-       u.`coupon_id`=d.`id`
+       `u`.`coupon_id`=`d`.`id`
 WHERE
-       u.`userid`=%s AND
-       u.`coupon_code` IS NULL AND
-       u.`cashed_on` IS NOT NULL
+       `u`.`userid`=%s AND
+       `u`.`coupon_code` IS NULL AND
+       `u`.`cashed_on` IS NOT NULL
 ORDER BY
-       u.`cashed_on` DESC", array(getMemberId()), __FILE__, __LINE__);
+       `u`.`cashed_on` DESC", array(getMemberId()), __FILE__, __LINE__);
 
-// Do we have entries?
-if (SQL_NUMROWS($result) > 0) {
+// Are there entries?
+if (!SQL_HASZERONUMS($result)) {
        // Init variable
        $OUT = '';
 
@@ -86,11 +86,11 @@ if (SQL_NUMROWS($result) > 0) {
                $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2');
 
                // Add the row template
-               $OUT .= loadTemplate('member_list_coupon_row', true, $content);
+               $OUT .= loadTemplate('member_list_coupon_row', TRUE, $content);
        } // END - while
 
        // Load main template
-       loadTemplate('member_list_coupon', false, $OUT);
+       loadTemplate('member_list_coupon', FALSE, $OUT);
 } else {
        // No cashed coupons found
        displayMessage('{--MEMBER_COUPON_CASHED_404--}');