win32 to unix line delimiters changed
[mailer.git] / 0.2.1 / inc / modules / admin / what-email_archiv.php
index d80ab0b9c08d2ee63d852d03caf82c401853629b..b267cc45b363055da9a7cec9db0d6eb4bf35d83e 100644 (file)
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1                                    Start: 09/28/2003 *\r
- * ===============                              Last change: 04/03/2004 *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * File              : what-email_archiv .php                           *\r
- * -------------------------------------------------------------------- *\r
- * Short description : See send emails details of ordered mails         *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung  : Alle  Mails ansehen die versand wurden           *\r
- * -------------------------------------------------------------------- *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
- * For more information visit: http://www.mxchange.org                  *\r
- *                                                                      *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or    *\r
- * (at your option) any later version.                                  *\r
- *                                                                      *\r
- * This program is distributed in the hope that it will be useful,      *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
- * GNU General Public License for more details.                         *\r
- *                                                                      *\r
- * You should have received a copy of the GNU General Public License    *\r
- * along with this program; if not, write to the Free Software          *\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
- * MA  02110-1301  USA                                                  *\r
- * -------------------------------------------------------------------- *\r
- * Mod-Copyright (c) 2004 by Robert Niedziela                           *\r
- * www.megacomputing.de                                                 *\r
- ************************************************************************/\r
-\r
-// Some security stuff...\r
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))\r
-{\r
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
-       require($INC);\r
-}\r
-// Add description as navigation point\r
-ADD_DESCR("admin", basename(__FILE__));\r
-\r
-//             0     1        2      3        4          5           6          7      8         9        10\r
-$SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id\r
- FROM "._MYSQL_PREFIX."_pool\r
- WHERE data_type='SEND' OR data_type='DELETED'\r
- ORDER BY timestamp DESC";\r
-\r
-// Check for maximum pages\r
-$result_normal = SQL_QUERY($SQL, __FILE__, __LINE__);\r
-\r
-// Set offset an current page to default values\r
-if (empty($_GET['page']))   $_GET['page']   = "1";\r
-if (empty($_GET['offset'])) $_GET['offset'] = $CONFIG['mails_page'];\r
-\r
-// Add limitation to SQL string\r
-$SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];\r
-\r
-// Run SQL query for normal mails\r
-$result = SQL_QUERY($SQL, __FILE__, __LINE__);\r
-\r
-// Calculate pages\r
-$PAGES = round(SQL_NUMROWS($result_normal) / $CONFIG['mails_page'] + 0.5);\r
-SQL_FREERESULT($result_normal);\r
-\r
-if (SQL_NUMROWS($result) > 0)\r
-{\r
-       // Mail orders are in pool so we can display them\r
-\r
-       // Add navigation table rows\r
-       if ($PAGES > 1)\r
-       {\r
-               define('__TOP_EMAIL_NAV'   , ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], true , "3", true));\r
-               define('__BOTTOM_EMAIL_NAV', ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], false, "3", true));\r
-       }\r
-        else\r
-       {\r
-               define('__TOP_EMAIL_NAV'   , "");\r
-               define('__BOTTOM_EMAIL_NAV', "");\r
-       }\r
-\r
-       $SW = 2; $OUT = "";\r
-       while ($pool = SQL_FETCHROW($result))\r
-       {\r
-               // Check sent mails and clicks\r
-               $result_mails = SQL_QUERY_ESC("SELECT max_rec, clicks FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%d LIMIT 1",\r
-                array(bigintval($pool[0])), __FILE__, __LINE__);\r
-               list($sent, $clicks) = SQL_FETCHROW($result_mails);\r
-               SQL_FREERESULT($result_mails);\r
-\r
-               // Unconfirmed mails\r
-               $unconfirmed = $sent - $clicks;\r
-               if ($unconfirmed > 0)\r
-               {\r
-                       // Add link to list_unconfirmed what-file\r
-                       $unconfirmed = "<STRONG><A href=\"".URL."/modules.php?module=admin&amp;what=list_unconfirmed&amp;mid=".$pool[0]."\">".$unconfirmed."</A></STRONG>";\r
-               }\r
-\r
-               // Prepare data for the row template\r
-               $content = array(\r
-                       'sw'          => $SW,\r
-                       'u_link'      => ADMIN_USER_PROFILE_LINK($pool[1]),\r
-                       'subj'        => COMPILE_CODE($pool[2]),\r
-                       'text'        => COMPILE_CODE($pool[3]),\r
-                       'pay'         => GET_PAYMENT($pool[5]),\r
-                       'cat'         => GET_CATEGORY($pool[10]),\r
-                       'sent'        => $sent,\r
-                       'ruids'       => str_replace(";", ", ", $pool[4]),\r
-                       'unconfirmed' => $unconfirmed,\r
-                       'type'        => GET_POOL_TYPE($pool[6]),\r
-                       'tsend'       => $pool[9],\r
-                       'url'         => FRAMETESTER($pool[8]),\r
-                       'stamp'       => MAKE_DATETIME($pool[7], "0"),\r
-                       'mid'         => $pool[0],\r
-               );\r
-\r
-               // Load row template and switch colors\r
-               $OUT .= LOAD_TEMPLATE("admin_email_archiv_row", true, $content);\r
-               $SW = 3 - $SW;\r
-       }\r
-\r
-       // Free memory\r
-       SQL_FREERESULT($result);\r
-       define('__EMAIL_ROWS', $OUT);\r
-\r
-       // Load main template\r
-       LOAD_TEMPLATE("admin_email_archiv");\r
-}\r
- else\r
-{\r
-       // No mail orders fond\r
-       OUTPUT_HTML ("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");\r
-}\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/28/2003 *
+ * ===============                              Last change: 04/03/2004 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-email_archiv .php                           *
+ * -------------------------------------------------------------------- *
+ * Short description : See send emails details of ordered mails         *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Alle  Mails ansehen die versand wurden           *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * 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                                                  *
+ * -------------------------------------------------------------------- *
+ * Mod-Copyright (c) 2004 by Robert Niedziela                           *
+ * www.megacomputing.de                                                 *
+ ************************************************************************/
+
+// Some security stuff...
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!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__));
+
+//             0     1        2      3        4          5           6          7      8         9        10
+$SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
+ FROM "._MYSQL_PREFIX."_pool
+ WHERE data_type='SEND' OR data_type='DELETED'
+ ORDER BY timestamp DESC";
+
+// Check for maximum pages
+$result_normal = SQL_QUERY($SQL, __FILE__, __LINE__);
+
+// Set offset an current page to default values
+if (empty($_GET['page']))   $_GET['page']   = "1";
+if (empty($_GET['offset'])) $_GET['offset'] = $CONFIG['mails_page'];
+
+// Add limitation to SQL string
+$SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
+
+// Run SQL query for normal mails
+$result = SQL_QUERY($SQL, __FILE__, __LINE__);
+
+// Calculate pages
+$PAGES = round(SQL_NUMROWS($result_normal) / $CONFIG['mails_page'] + 0.5);
+SQL_FREERESULT($result_normal);
+
+if (SQL_NUMROWS($result) > 0)
+{
+       // Mail orders are in pool so we can display them
+
+       // Add navigation table rows
+       if ($PAGES > 1)
+       {
+               define('__TOP_EMAIL_NAV'   , ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], true , "3", true));
+               define('__BOTTOM_EMAIL_NAV', ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], false, "3", true));
+       }
+        else
+       {
+               define('__TOP_EMAIL_NAV'   , "");
+               define('__BOTTOM_EMAIL_NAV', "");
+       }
+
+       $SW = 2; $OUT = "";
+       while ($pool = SQL_FETCHROW($result))
+       {
+               // Check sent mails and clicks
+               $result_mails = SQL_QUERY_ESC("SELECT max_rec, clicks FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%d LIMIT 1",
+                array(bigintval($pool[0])), __FILE__, __LINE__);
+               list($sent, $clicks) = SQL_FETCHROW($result_mails);
+               SQL_FREERESULT($result_mails);
+
+               // Unconfirmed mails
+               $unconfirmed = $sent - $clicks;
+               if ($unconfirmed > 0)
+               {
+                       // Add link to list_unconfirmed what-file
+                       $unconfirmed = "<STRONG><A href=\"".URL."/modules.php?module=admin&amp;what=list_unconfirmed&amp;mid=".$pool[0]."\">".$unconfirmed."</A></STRONG>";
+               }
+
+               // Prepare data for the row template
+               $content = array(
+                       'sw'          => $SW,
+                       'u_link'      => ADMIN_USER_PROFILE_LINK($pool[1]),
+                       'subj'        => COMPILE_CODE($pool[2]),
+                       'text'        => COMPILE_CODE($pool[3]),
+                       'pay'         => GET_PAYMENT($pool[5]),
+                       'cat'         => GET_CATEGORY($pool[10]),
+                       'sent'        => $sent,
+                       'ruids'       => str_replace(";", ", ", $pool[4]),
+                       'unconfirmed' => $unconfirmed,
+                       'type'        => GET_POOL_TYPE($pool[6]),
+                       'tsend'       => $pool[9],
+                       'url'         => FRAMETESTER($pool[8]),
+                       'stamp'       => MAKE_DATETIME($pool[7], "0"),
+                       'mid'         => $pool[0],
+               );
+
+               // Load row template and switch colors
+               $OUT .= LOAD_TEMPLATE("admin_email_archiv_row", true, $content);
+               $SW = 3 - $SW;
+       }
+
+       // Free memory
+       SQL_FREERESULT($result);
+       define('__EMAIL_ROWS', $OUT);
+
+       // Load main template
+       LOAD_TEMPLATE("admin_email_archiv");
+}
+ else
+{
+       // No mail orders fond
+       OUTPUT_HTML ("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");
+}
+//
+?>