Extension 'ext-coupon' moved to branch, SQLs improved:
authorRoland Häder <roland@mxchange.org>
Fri, 10 Jun 2011 22:12:18 +0000 (22:12 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 10 Jun 2011 22:12:18 +0000 (22:12 +0000)
- All database columns should be surrounded with backticks (`) in all SQL
  statements
- Extension 'ext-coupon' resurrected from 'contrib'

17 files changed:
.gitattributes
inc/extensions/ext-coupon.php [new file with mode: 0644]
inc/libs/rallye_functions.php
inc/libs/task_functions.php
inc/modules/admin/what-list_bonus.php
inc/modules/admin/what-unlock_sponsor.php
inc/modules/guest/what-mediadata.php
inc/modules/guest/what-sponsor_login.php
inc/modules/guest/what-sponsor_reg.php
inc/modules/guest/what-top10.php
inc/modules/member/what-beg2.php
inc/modules/member/what-bonus.php
inc/modules/member/what-unconfirmed.php
inc/modules/sponsor/welcome.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
templates/de/html/ext/ext_coupon.tpl [new file with mode: 0644]

index 26353d9..a88d175 100644 (file)
@@ -139,6 +139,7 @@ inc/extensions/ext-booking.php svneol=native#text/plain
 inc/extensions/ext-cache.php svneol=native#text/plain
 inc/extensions/ext-clickbanner.php svneol=native#text/plain
 inc/extensions/ext-country.php svneol=native#text/plain
+inc/extensions/ext-coupon.php svneol=native#text/plain
 inc/extensions/ext-debug.php svneol=native#text/plain
 inc/extensions/ext-demo.php svneol=native#text/plain
 inc/extensions/ext-doubler.php svneol=native#text/plain
@@ -1381,6 +1382,7 @@ templates/de/html/ext/ext_booking.tpl svneol=native#text/plain
 templates/de/html/ext/ext_cache.tpl svneol=native#text/plain
 templates/de/html/ext/ext_clickbanner.tpl svneol=native#text/plain
 templates/de/html/ext/ext_country.tpl svneol=native#text/plain
+templates/de/html/ext/ext_coupon.tpl svneol=native#text/plain
 templates/de/html/ext/ext_debug.tpl svneol=native#text/plain
 templates/de/html/ext/ext_demo.tpl svneol=native#text/plain
 templates/de/html/ext/ext_doubler.tpl svneol=native#text/plain
diff --git a/inc/extensions/ext-coupon.php b/inc/extensions/ext-coupon.php
new file mode 100644 (file)
index 0000000..091971a
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/************************************************************************
+ * Mailer-Project 0.2.1-FINAL                         Start: 01/07/2005 *
+ * ==========================                   Last change: 01/07/2005 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : ext-coupon.php                                   *
+ * -------------------------------------------------------------------- *
+ * Short description : Coupon system                                    *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Coupon-System                                    *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       die();
+} // END - if
+
+// Version number
+setThisExtensionVersion('0.0');
+
+// Version history array (add more with , '0.1' and so on)
+setExtensionVersionHistory(array('0.0'));
+
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
+               // SQL commands to run
+               addExtensionSql('');
+               break;
+
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               addExtensionSql('');
+               break;
+
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql('');
+               break;
+
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql('');
+               break;
+
+       case 'update': // Update an extension
+               switch (getCurrentExtensionVersion()) {
+                       case '0.0.1': // SQL queries for v0.0.1
+                               addExtensionSql('');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes('');
+                               break;
+               } // END - switch
+               break;
+
+       case 'modify': // When the extension got modified
+               break;
+
+       case 'test': // For testing purposes
+               break;
+
+       case 'init': // Do stuff when extension is initialized
+               break;
+
+       default: // Unknown extension mode
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+               break;
+} // END - switch
+
+// [EOF]
+?>
index b2fb680..4fbc604 100644 (file)
@@ -108,7 +108,7 @@ LIMIT 1",
 
                        // Add userid and his ref count to table
                        $result_ref = SQL_QUERY_ESC("SELECT 
-       SUM(p.points) AS points
+       SUM(p.points) AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_points` AS p
 LEFT JOIN
@@ -645,7 +645,7 @@ function getArrayFromReferalRallyeUsers ($rallye) {
 
                // Points of ref's
                $result_ref = SQL_QUERY_ESC("SELECT
-       SUM(p.points) AS points
+       SUM(p.points) AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_points` AS p
 LEFT JOIN
index 6698aba..46dd7e1 100644 (file)
@@ -340,7 +340,7 @@ ORDER BY
                } // END - if
 
                addSql("SELECT
-       " . $USE . " AS points
+       " . $USE . " AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
index 0667f2b..0673118 100644 (file)
@@ -76,7 +76,7 @@ if (isBonusRallyeActive()) {
 
        // Check if at least one is in the active rallye
        $result = SQL_QUERY_ESC("SELECT
-       `userid`, `email`, `gender`, `surname`, `family`, ".$USE." AS points, `last_online`
+       `userid`, `email`, `gender`, `surname`, `family`, ".$USE." AS `points`, `last_online`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
index 74bd7e8..3a1852f 100644 (file)
@@ -159,7 +159,7 @@ LIMIT 1",
                                        // Load referal's data
                                        $result = SQL_QUERY_ESC("SELECT
        `id`, `gender`, `surname`, `family`, `email`,
-       (`points_amount` - `points_used`) AS points,
+       (`points_amount` - `points_used`) AS `points`,
        `receive_warnings`, `ref_count` AS refs
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
index 25ef234..a6f7d71 100644 (file)
@@ -243,7 +243,7 @@ WHERE
 if (isExtensionActive('transfer')) {
        // Statistics for points transfers
        $result = SQL_QUERY("SELECT
-       COUNT(t.id) AS cnt, SUM(t.points) AS points
+       COUNT(t.id) AS cnt, SUM(t.points) AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_transfers_in` AS t
 LEFT JOIN
index b86614b..7082a5c 100644 (file)
@@ -67,7 +67,7 @@ if (isGetRequestParameterSet('hash')) {
        `id`, `status`, `gender`, `surname`, `family`,
        `company`, `position`, `tax_ident`,
        `street_nr1`, `street_nr2`, `country`, `zip`, `city`, `email`, `phone`, `fax`, `cell`,
-       `points_amount` AS points, `last_payment`, `last_currency`
+       `points_amount` AS `points`, `last_payment`, `last_currency`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
index 3a8a201..bc5bbdf 100644 (file)
@@ -206,7 +206,7 @@ if ((isFormSent()) && (count($formErrors) == 0)) {
 
        // Calulate points
        $result = SQL_QUERY_ESC("SELECT
-       (`pay_rate` * `pay_min_count`) AS points, `pay_min_count` AS pay, `pay_currency` AS curr
+       (`pay_rate` * `pay_min_count`) AS `points`, `pay_min_count`, `pay_currency`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_paytypes`
 WHERE
index 0e1d490..a5ad5e6 100644 (file)
@@ -110,7 +110,7 @@ SQL_FREERESULT($result);
 //// TOP earners
 $result = SQL_QUERY("SELECT
        d.userid,
-       (SUM(p.points) - d.used_points) AS points,
+       (SUM(p.points) - d.used_points) AS `points`,
        d.last_online
 FROM
        `{?_MYSQL_PREFIX?}_user_data` AS d
index 996c31a..25b5bdc 100644 (file)
@@ -61,7 +61,7 @@ if (isExtensionActive('autopurge')) {
 
 // Let's check if there are some points left we can pay...
 $result = SQL_QUERY_ESC("SELECT
-       `userid`, `beg_points` AS points, `last_online`
+       `userid`, `beg_points`, `last_online`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
@@ -84,10 +84,11 @@ if (!SQL_HASZERONUMS($result)) {
        $count = 1;
        while ($content = SQL_FETCHARRAY($result)) {
                // Prepare data for the template
+               // @TODO points->beg_points
                $content = array(
                        'cnt'         => $count,
                        'userid'      => $content['userid'],
-                       'points'      => $content['points'],
+                       'points'      => $content['beg_points'],
                        'last_online' => generateDateTime($content['last_online'], 2),
                );
 
index 8c8233c..2fc94b3 100644 (file)
@@ -74,7 +74,7 @@ if (isExtensionActive('autopurge')) {
 
 // Let's check if there are some points left we can 'pay'...
 $result = SQL_QUERY_ESC("SELECT
-       `userid`, ".$USE." AS points, `last_online`
+       `userid`, ".$USE." AS `points`, `last_online`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
index 9f06817..2cad2b4 100644 (file)
@@ -81,7 +81,8 @@ LIMIT 1",
 } elseif (isGetRequestParameterSet('mailid')) {
        // Display regular member mail by loading its full data
        $result_data = SQL_QUERY_ESC("SELECT
-       s.id, s.subject, p.text, s.timestamp_ordered AS `timestamp`, s.cat_id, pay.price AS points, p.sender, pay.time, p.data_type
+       s.id, s.subject, p.text, s.timestamp_ordered AS `timestamp`,
+       s.cat_id, pay.price AS `points`, p.sender, pay.time, p.data_type
 FROM
        `{?_MYSQL_PREFIX?}_user_stats` AS s
 LEFT JOIN
index 1a37ea1..a740df3 100644 (file)
@@ -49,7 +49,7 @@ if (!defined('__SECURITY')) {
 
 // Load some data
 $result = SQL_QUERY_ESC("SELECT
-       `id`, `gender`, `surname`, `family`, (`points_amount` - `points_used`) AS points
+       `id`, `gender`, `surname`, `family`, (`points_amount` - `points_used`) AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
index b047842..232bee7 100644 (file)
@@ -71,7 +71,7 @@ if ((getBegRanks() > 0) && (!isCssOutputMode())) {
 
        // SQL string to check for accounts
        $result_main = SQL_QUERY("SELECT
-       `userid`, `email`, `gender`, `surname`, `family`, `beg_points` AS points
+       `userid`, `email`, `gender`, `surname`, `family`, `beg_points` AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
index 35d5b1e..ca916cb 100644 (file)
@@ -78,7 +78,7 @@ if ((getConfig('bonus_ranks') > 0) && (!isCssOutputMode())) {
 
        // Run SQL string to check for accounts
        $result_main = SQL_QUERY('SELECT
-       `userid`, `email`, `gender`, `surname`, `family`, (0' . $add . ') AS points
+       `userid`, `email`, `gender`, `surname`, `family`, (0' . $add . ') AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 ' . $whereStatement1 . '
diff --git a/templates/de/html/ext/ext_coupon.tpl b/templates/de/html/ext/ext_coupon.tpl
new file mode 100644 (file)
index 0000000..ca0c5b6
--- /dev/null
@@ -0,0 +1,11 @@
+<div class="para">
+       Stellen Sie Ihren neuen Mitgliedern Bonus-Coupons aus, mit denen sie an
+       Sonderaktionen, Bonus-Aktionen usw. dran teilnehmen lassen k&ouml;nnen! Es
+       k&ouml;nnen auch einfach nur Gutscheine versendet werden, die die Mitglieder
+       im Mitgliedsbereich einl&ouml;sen und daf&uuml;r {?POINTS?} erhalten.
+</div>
+
+<div class="para">
+       F&uuml;r alle Gutscheine kann eine Ablaufzeit eingestellt werden, nach der
+       der Gutschein wieder verf&auml;llt.
+</div>