Listing of notifications added
authorRoland Häder <roland@mxchange.org>
Tue, 7 Oct 2008 00:05:35 +0000 (00:05 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 7 Oct 2008 00:05:35 +0000 (00:05 +0000)
12 files changed:
.gitattributes
inc/databases.php
inc/extensions/ext-bonus.php
inc/functions.php
inc/language/task_de.php
inc/libs/task_functions.php
inc/mails/beg_mails.php
inc/mails/birthday_mails.php
inc/mails/bonus_mails.php
inc/modules/admin/what-config_bonus.php
inc/modules/admin/what-email_details.php
inc/modules/admin/what-list_notifications.php [new file with mode: 0644]

index 9b5b302..ee4d863 100644 (file)
@@ -354,6 +354,7 @@ inc/modules/admin/what-list_holiday.php -text
 inc/modules/admin/what-list_links.php -text
 inc/modules/admin/what-list_newsletter.php -text
 inc/modules/admin/what-list_norefs.php -text
+inc/modules/admin/what-list_notifications.php -text
 inc/modules/admin/what-list_payouts.php -text
 inc/modules/admin/what-list_primera.php -text
 inc/modules/admin/what-list_rallyes.php -text
index b772424..8506ba3 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "469");
+define('CURR_SVN_REVISION', "470");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 9e22079..b1270ac 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Version of this extension
-$EXT_VERSION = "0.8.6";
+$EXT_VERSION = "0.8.7";
 
 // Auto-set extension version
 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.1.6", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9", "0.7.0", "0.7.1", "0.7.2", "0.7.3", "0.7.4", "0.7.5", "0.7.6", "0.7.7", "0.7.8", "0.7.9", "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.8.6");
+$EXT_VER_HISTORY = array("0.0", "0.1.6", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9", "0.7.0", "0.7.1", "0.7.2", "0.7.3", "0.7.4", "0.7.5", "0.7.6", "0.7.7", "0.7.8", "0.7.9", "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.8.6", "0.8.7");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -80,7 +80,7 @@ PRIMARY KEY  (id)
 
 case "remove": // Do stuff when removing extension
        // SQL commands to run
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what IN ('bonus','config_bonus','send_bonus','list_bonus') LIMIT 4";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what IN ('bonus','config_bonus','send_bonus','list_bonus','list_notifications') LIMIT 5";
        $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='bonus' LIMIT 1";
        $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE action='bonus' LIMIT 1";
        $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_links MODIFY link_type ENUM('NORMAL') NOT NULL DEFAULT 'NORMAL'";
@@ -526,29 +526,31 @@ WHERE last_online < ".$mark." ORDER BY userid";
        case "0.8.6": // SQL queries for v0.8.6
                $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
                break;
+
+       case "0.8.7": // SQL queries for v0.8.7
+               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','list_notifications','Benachrichtigungen','Listet alle an die Mitglieder ausgesandten Benachrichtigungen auf.', 10)";
+
+               // Update notes
+               $UPDATE_NOTES = "Benachrichtigungsmails f&uuml;r z.B. Bettel- oder Aktiv-Rallye werden nun angezeigt.";
+               break;
        }
        break;
 
 default: // Do stuff when extension is loaded
-       if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
-       {
+       if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) {
                // Daily reset was run so let's check if active rallye is activated
-               if ($_CONFIG['bonus_active'] == "Y")
-               {
+               if ($_CONFIG['bonus_active'] == "Y") {
                        // Run active rallye
                        if($_CONFIG['bonus_stats'] > 0) $INC_POOL[] = sprintf("%sinc/stats_bonus.php", PATH);
                        $INC_POOL[] = sprintf("%sinc/monthly/monthly_bonus.php", PATH);
-               }
-                else
-               {
+               } else {
                        // Reset points
                        $INC_POOL[] = sprintf("%sinc/reset/reset_bonus.php", PATH);
                }
        }
 
        // Check for bonus rallye is active and send mails out
-       if (($_CONFIG['bonus_active'] == "Y") && ($_CONFIG['bonus_new_mem_notify'] == "Y"))
-       {
+       if (($_CONFIG['bonus_active'] == "Y") && ($_CONFIG['bonus_new_mem_notify'] == "Y")) {
                // Include file for sending out mails
                $INC_POOL[] = sprintf("%sinc/mails/bonus_mails.php", PATH);
        }
index 28ecf9e..6ec587a 100644 (file)
@@ -2374,6 +2374,9 @@ function GET_DIR_AS_ARRAY ($baseDir, $prefix) {
        // Close directory
        closedir($dirPointer);
 
+       // Sort array
+       asort($INCs);
+
        // Return array with include files
        return $INCs;
 }
index 24801c6..f8907f0 100644 (file)
@@ -119,7 +119,9 @@ define('TASK_ADMIN_LIST_ACCOUNT_NOREF_TITLE', "Es wurden Accounts ohne Werber-ID
 define('TASK_ADMIN_LIST_SURFBAR_URLS_ALL', "Alle URLs in Surfbar");
 define('TASK_ADMIN_LIST_SURFBAR_URLS_ALL_TITLE', "In der Surfbar sind URLs gebucht worden.");
 define('TASK_ADMIN_LIST_SURFBAR_URLS_PENDING', "Wartende URLs in Surfbar");
-define('TASK_ADMIN_LIST_SURFBAR_URLS_PENDING_TITLE', "Es warten noch URLs auf Freischaltung f&uuml;r die Surfbar");
+define('TASK_ADMIN_LIST_SURFBAR_URLS_PENDING_TITLE', "Es warten noch URLs auf Freischaltung f&uuml;r die Surfbar.");
+define('TASK_ADMIN_LIST_NOTIFICATIONS', "Alle  Benachrichtigungen");
+define('TASK_ADMIN_LIST_NOTIFICATIONS_TITLE', "Es sind ausgesandte,verg&uuml;tete Benachrichtigungen vorhanden.");
 
 //
 ?>
index 426309f..7880813 100644 (file)
@@ -255,7 +255,7 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main)
        // Sent bonus mails
        //
        if (GET_EXT_VERSION("bonus") >= "0.1.8") {
-               $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE data_type='SEND'", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE data_type='SEND' AND is_notify='N'", __FILE__, __LINE__);
                $value = SQL_NUMROWS($result);
                SQL_FREERESULT($result);
 
@@ -359,12 +359,21 @@ ORDER BY d.userid";
                        $LAST   = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", $_CONFIG['ap_inactive_since']);
                }
 
-               $SQLs[]   = "SELECT ".$USE." AS active_bonus FROM "._MYSQL_PREFIX."_user_data
+               $SQLs[]   = "SELECT ".$USE." AS active_bonus
+FROM "._MYSQL_PREFIX."_user_data
 WHERE status='CONFIRMED' AND ".$USE.">0".$LAST."
 ORDER BY active_bonus DESC, userid";
                $WHATs[]  = "list_bonus";
                $DESCRs[] = TASK_ADMIN_LIST_BONUS;
                $TITLEs[] = TASK_ADMIN_LIST_BONUS_TITLE;
+
+               if (GET_EXT_VERSION("bonus") >= "0.8.7") {
+                       // List all notifications
+                       $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE is_notify='Y' ORDER BY timestamp DESC";
+                       $WHATs[]  = "list_notiftications";
+                       $DESCRs[] = TASK_ADMIN_LIST_NOTIFICATIONS;
+                       $TITLEs[] = TASK_ADMIN_LIST_NOTIFICATIONS_TITLE;
+               }
        }
 
        if (GET_EXT_VERSION("beg") >= "0.1.2") {
index 3247190..545b552 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
 
 // Do not execute when script is in CSS mode
 global $CSS;
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if ($CSS == 1) return;
 
 // Create timemark from saved month
 $mark = mktime(0, 0, 0, $_CONFIG['last_month'], date("d", time()), date('Y', time()));
@@ -133,7 +133,7 @@ SET beg_ral_notify='%s', beg_ral_%s_notify='%s' WHERE userid=%s LIMIT 1",
                        {
                                // Send normal notification mail to the members
                                $MSG = LOAD_EMAIL_TEMPLATE("beg_".$MODE."_notify", array(), $uid);
-                               SEND_EMAIL($email, $SUBJECT, $MSG);
+                               SEND_EMAIL($uid, $SUBJECT, $MSG);
                        }
                }
 
index 83d8eb4..71a6169 100644 (file)
@@ -96,7 +96,7 @@ if (SQL_NUMROWS($result_birthday) > 0) {
                }
 
                // Send email
-               SEND_EMAIL($email, HAPPY_BIRTHDAY, $msg);
+               SEND_EMAIL($uid, HAPPY_BIRTHDAY, $msg);
 
                // Remember him that he has received a birthday mail
                $result_bd = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET birthday_sent=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
index 5072685..ad84a34 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
 
 // Do not execute when script is in CSS mode
 global $CSS;
-if (($CSS == 1) || (!defined('__DAILY_RESET')))  return;
+if ($CSS == 1) return;
 
 // Create timemark from saved month
 $mark = mktime(0, 0, 0, $_CONFIG['last_month'], date("d", time()), date('Y', time()));
@@ -52,36 +52,29 @@ $SQL = "SELECT userid, email FROM "._MYSQL_PREFIX."_user_data WHERE (bonus_ral_n
 switch ($_CONFIG['bonus_active'])
 {
 case 'Y': // Active rallye is activated
-       if ($_CONFIG['bonus_en_notify'] == "Y")
-       {
+       if ($_CONFIG['bonus_en_notify'] == "Y") {
                // Okay, let's check for member accounts
                $SQL .= "= 0 OR (bonus_ral_notify > 0 AND bonus_ral_en_notify < bonus_ral_di_notify)";
                $MODE = "en";
-       }
-        else
-       {
+       } else {
                // Do not notify!
                $SQL = "";
        }
        break;
 
 case 'N': // Active rallye is deactivated
-       if ($_CONFIG['bonus_di_notify'] == "Y")
-       {
+       if ($_CONFIG['bonus_di_notify'] == "Y") {
                // Okay, let's check for member accounts
                $SQL .= " > 0 AND bonus_ral_di_notify < bonus_ral_en_notify";
                $MODE = "di";
-       }
-        else
-       {
+       } else {
                // Do not notify!
                $SQL = "";
        }
        break;
 }
 
-if (!empty($SQL))
-{
+if (!empty($SQL)) {
        // The SQL command needs to be finisched here (only confirmed accounts!)
        $SQL .= ") AND status='CONFIRMED' ORDER BY last_online ASC";
 
@@ -98,33 +91,27 @@ if (!empty($SQL))
 
        // Check for accounts to be notified
        $result_main = SQL_QUERY($SQL, __FILE__, __LINE__);
-       if (SQL_NUMROWS($result_main) > 0)
-       {
+       if (SQL_NUMROWS($result_main) > 0) {
                // Okay lets notify all users!
-               while(list($uid, $email) = SQL_FETCHROW($result_main))
-               {
+               while(list($uid, $email) = SQL_FETCHROW($result_main)) {
                        // Update account
                        $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data
 SET bonus_ral_notify='%s', bonus_ral_%s_notify='%s' WHERE userid=%s LIMIT 1",
  array(time(), $MODE, time(), $uid), __FILE__, __LINE__);
 
                        // Load email template and send it to the user!
-                       if ($MAIL_MODE)
-                       {
+                       if ($MAIL_MODE) {
                                // Add userid to queue
                                $UIDs[] = $uid;
-                       }
-                        else
-                       {
+                       } else {
                                // Send normal notification mail to the members
                                $MSG = LOAD_EMAIL_TEMPLATE("bonus_".$MODE."_notify", array(), $uid);
-                               SEND_EMAIL($email, $SUBJECT, $MSG);
+                               SEND_EMAIL($uid, $SUBJECT, $MSG);
                        }
                }
 
                // Shall I send out bonus mails?
-               if ($MAIL_MODE)
-               {
+               if ($MAIL_MODE) {
                        // Okay, make array to string
                        $RECEIVER = implode(";", $UIDs);
                        $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus
@@ -147,5 +134,6 @@ VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(), '%s','%s','%s','%s','Y
        // Free memory
        SQL_FREERESULT($result_main);
 }
+
 //
 ?>
index 6515531..21f8293 100644 (file)
@@ -72,6 +72,7 @@ if (isset($_POST['ok']))
 
        // Include sending out mails
        if ((($_CONFIG['bonus_active'] == "Y") && ($_CONFIG['bonus_en_notify'] == "Y")) || (($_CONFIG['bonus_active'] == "N") && ($_CONFIG['bonus_di_notify'] == "Y"))) {
+               // Send mails out!
                include(PATH."inc/mails/bonus_mails.php");
        }
 } else {
index 6762cc9..7d1d652 100644 (file)
@@ -85,8 +85,9 @@ if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL)) {
        // Bonus mails sent by you
        //               0     1       2        3        4      5       6          7       8      9         10          11        12
        $SQL2 = "SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent, clicks
-        FROM "._MYSQL_PREFIX."_bonus
-        ORDER BY timestamp DESC";
+       FROM "._MYSQL_PREFIX."_bonus
+       WHERE is_notify='N'
+       ORDER BY timestamp DESC";
 
        // Check for maximum pages
        $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
diff --git a/inc/modules/admin/what-list_notifications.php b/inc/modules/admin/what-list_notifications.php
new file mode 100644 (file)
index 0000000..439c77f
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 10/07/2008 *
+ * ===============                              Last change: 10/07/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-list_notifications.php                      *
+ * -------------------------------------------------------------------- *
+ * Short description : See all notification emails (beg/active rallye)  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Alle Benachrichtigungen sehen (Bettel-/Aktiv-R.) *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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')) || (!IS_ADMIN())) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Add description as navigation point
+ADD_DESCR("admin", basename(__FILE__));
+
+// Init variables
+$WHO = _ALL;
+$SQL2 = "";
+
+// Set offset an current page to default values
+if (empty($_GET['page']))   $_GET['page']   = "1";
+if (empty($_GET['offset'])) $_GET['offset'] = $_CONFIG['mails_page'];
+
+if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL)) {
+       // Bonus mails sent by you
+       //               0     1       2        3        4      5       6          7       8      9         10          11        12
+       $SQL2 = "SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent, clicks
+FROM "._MYSQL_PREFIX."_bonus
+WHERE is_notify='Y'
+ORDER BY timestamp DESC";
+
+       // Check for maximum pages
+       $result_max = SQL_QUERY($SQL2, __FILE__, __LINE__);
+} else {
+       // Bonus extension required!
+}
+
+// Create limitation line
+$ADD = " LIMIT ".(bigintval($_GET['offset']) * bigintval($_GET['page']) - bigintval($_GET['offset'])).", ".bigintval($_GET['offset']);
+
+// Add limitation
+if (!empty($SQL2)) $SQL2 .= $ADD;
+
+if ((EXT_IS_ACTIVE("bonus")) && (SQL_NUMROWS($result_max) > 0) && (!empty($SQL2))) {
+       // Run SQL query for notification mails
+       $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
+
+       // Load bonus mails only when extension is active
+       if (SQL_NUMROWS($result_bonus) > 0) {
+               // Calculate pages
+               $PAGES = round(SQL_NUMROWS($result_bonus) / $_CONFIG['mails_page'] + 0.5);
+
+               // List emails
+               $OUT = ""; $content = array();
+               while ($bonus = SQL_FETCHARRAY($result_bonus)) {
+                       // Calculate unconfirmed emails
+                       $bonus['unconfirmed'] = $bonus['mails_sent'] - $bonus['clicks'];
+
+                       // Add link?
+                       if ($bonus['unconfirmed'] > 0) {
+                               // Add link to list_unconfirmed what-file
+                               $bonus['unconfirmed'] = "<STRONG><A href=\"".URL."/modules.php?module=admin&amp;what=list_unconfirmed&amp;bid=".$bonus['id']."\">".$bonus['unconfirmed']."</A></STRONG>";
+                       } // END - if
+
+                       // Prepare content
+                       $content = $bonus;
+                       $content['time']        = CREATE_FANCY_TIME($content['time']);
+                       $content['category']    = GET_CATEGORY($content['cat_id']);
+                       $content['receivers']   = str_replace(";", ", ", $content['receivers']);
+                       $content['type']        = TRANSLATE_POOL_TYPE($content['data_type']);
+                       $content['frametester'] = FRAMETESTER($content['url']);
+                       $content['timestamp']   = MAKE_DATETIME($content['timestamp'], "0");
+
+                       // Load row template
+                       $OUT .= LOAD_TEMPLATE("admin_list_bonus_emails_row", true, $content);
+               }
+
+               // Add navigation (without change box but with colspan=3)
+               $content['nav'] = "";
+               if ($PAGES > 1) $content['nav'] = ADD_EMAIL_NAV($PAGES, $_CONFIG['mails_page'], false, "3", true);
+
+               // Prepare content
+               $content['rows'] = $OUT;
+
+               // Load main template
+               LOAD_TEMPLATE("admin_list_bonus_emails", false, $content);
+       }
+}
+
+//
+?>