win32 to unix line delimiters changed
[mailer.git] / 0.2.1 / inc / modules / admin / what-list_links.php
index b8bc605a199ce42c712b023ccff4d9b65224c990..a72ee9b5b358705f2f1263c12ba491f180f52e1b 100644 (file)
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1                                    Start: 01/28/2004 *\r
- * ================                             Last change: 12/13/2004 *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * File              : what-list_links.php                              *\r
- * -------------------------------------------------------------------- *\r
- * Short description : List unconfirmed mails of a member               *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung  : Unbestaetigte Mails eines Mitgliedes auflisten   *\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
-\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
-\r
-// Add description as navigation point\r
-ADD_DESCR("admin", basename(__FILE__));\r
-\r
-if (empty($_GET['del'])) $_GET['del'] = "";\r
-\r
-OPEN_TABLE("100%", "admin_content admin_content_align", "");\r
-if (!empty($_GET['u_id']))\r
-{\r
-       // Check if the user already exists\r
-       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",\r
-        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-       if (SQL_NUMROWS($result) == 1)\r
-       {\r
-               // Loads surname, family's name and the email address\r
-               list($sname, $fname, $email) = SQL_FETCHROW($result);\r
-               SQL_FREERESULT($result);\r
-\r
-               // Grab user's all unconfirmed mails\r
-               if (EXT_IS_ACTIVE("bonus"))\r
-               {\r
-                       // Load bonus ID\r
-                       $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d ORDER BY id",\r
-                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-               }\r
-                else\r
-               {\r
-                       // Load stats ID (2nd will be ignored later! But it is needed for the same fetchrow command)\r
-                       $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d ORDER BY id",\r
-                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-               }\r
-\r
-               $nums = bigintval(SQL_NUMROWS($result));\r
-               if ($nums > 0)\r
-               {\r
-                       // Some unconfirmed mails left\r
-                       if ($_GET['del'] == "all")\r
-                       {\r
-                               // Delete all unconfirmed mails by this user\r
-                               $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d LIMIT %s",\r
-                                array(bigintval($_GET['u_id']), $nums), __FILE__, __LINE__);\r
-\r
-                               // Prepare mail and send it away\r
-                               $msg = LOAD_EMAIL_TEMPLATE("admin-del_links", $nums, bigintval($_GET['u_id']));\r
-                               SEND_EMAIL($email, ADMIN_DEL_LINK_SUBJ, $msg);\r
-\r
-                               // Display message\r
-                               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LINKS_DELETED);\r
-                       }\r
-                        else\r
-                       {\r
-                               // List all unconfirmed mails\r
-                               $SW = 2; $OUT = "";\r
-                               while (list($id, $id2, $type) = SQL_FETCHROW($result))\r
-                               {\r
-                                       // Load data from stats table...\r
-                                       $cat = "";\r
-                                       switch ($type)\r
-                                       {\r
-                                       case "NORMAL":\r
-                                               $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%d LIMIT 1",\r
-                                                array(bigintval($id)), __FILE__, __LINE__);\r
-                                               $TYPE = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM;\r
-                                               $LINK = "<A href=\"".URL."/mailid.php?uid=".$_GET['u_id']."&amp;mailid=".$id."\" target=\"_blank\">".$id."</A>";\r
-                                               break;\r
-\r
-                                       case "BONUS":\r
-                                               $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM "._MYSQL_PREFIX."_bonus WHERE id=%d LIMIT 1",\r
-                                                array(bigintval($id2)), __FILE__, __LINE__);\r
-                                               $TYPE = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM;\r
-                                               $LINK = "<A href=\"".URL."/mailid.php?uid=".$_GET['u_id']."&amp;bonusid=".$id2."\" target=\"_blank\">".$id2."</A>";\r
-                                               break;\r
-                                       }\r
-\r
-                                       if (SQL_NUMROWS($result_data) == 1)\r
-                                       {\r
-                                               // Mail was found!\r
-                                               list($subject, $timestamp, $cat) = SQL_FETCHROW($result_data);\r
-                                               SQL_FREERESULT($result_data);\r
-                                               if (empty($subject)) $subject = DEFAULT_SUBJECT_LINE;\r
-\r
-                                               // Prepare data for the row template\r
-                                               $content = array(\r
-                                                       'sw'    => $SW,\r
-                                                       'link'  => $LINK,\r
-                                                       'subj'  => $subject,\r
-                                                       'stamp' => MAKE_DATETIME($timestamp, "0"),\r
-                                                       'cat'   => GET_CATEGORY($cat),\r
-                                               );\r
-\r
-                                               // Load row template\r
-                                               $OUT .= LOAD_TEMPLATE("admin_list_links_row", true, $content);\r
-                                       }\r
-                                        else\r
-                                       {\r
-                                               $OUT .= "<TR>\r
-  <TD align=\"center\" class=\"switch_sw".$SW." bottom2\" colspan=\"4\">\r
-    <STRONG class=\"member_failed large\">".$PROBLEM.":</STRONG> ".$DATA."\r
-  </TD>\r
-</TR>\n";\r
-                                       }\r
-                                       $SW = 3 - $SW;\r
-                               }\r
-\r
-                               // Free memory\r
-                               SQL_FREERESULT($result);\r
-\r
-                               // Remember list in constant for the template\r
-                               define('__SNAME_VALUE', $sname);\r
-                               define('__FNAME_VALUE', $fname);\r
-                               define('__EMAIL_VALUE', "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>");\r
-                               define('__EMAIL_LIST' , $OUT);\r
-                               define('__NUMS_VALUE' , $nums);\r
-                               define('__UID_VALUE'  , $_GET['u_id']);\r
-\r
-                               // Load final template\r
-                               LOAD_TEMPLATE("admin_list_links");\r
-                       }\r
-               }\r
-                else\r
-               {\r
-                       // No mails left to confirm\r
-                       LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_LINKS_1.$_GET['u_id'].ADMIN_MEMBER_LINKS_2);\r
-               }\r
-       }\r
-        else\r
-       {\r
-               // User not found\r
-               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2);\r
-       }\r
-}\r
- else\r
-{\r
-       // Output selection form with all confirmed user accounts listed\r
-       ADD_MEMBER_SELECTION_BOX();\r
-}\r
-CLOSE_TABLE();\r
-\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 01/28/2004 *
+ * ================                             Last change: 12/13/2004 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-list_links.php                              *
+ * -------------------------------------------------------------------- *
+ * Short description : List unconfirmed mails of a member               *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Unbestaetigte Mails eines Mitgliedes auflisten   *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * 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 ((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__));
+
+if (empty($_GET['del'])) $_GET['del'] = "";
+
+OPEN_TABLE("100%", "admin_content admin_content_align", "");
+if (!empty($_GET['u_id']))
+{
+       // Check if the user already exists
+       $result = SQL_QUERY_ESC("SELECT surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+       if (SQL_NUMROWS($result) == 1)
+       {
+               // Loads surname, family's name and the email address
+               list($sname, $fname, $email) = SQL_FETCHROW($result);
+               SQL_FREERESULT($result);
+
+               // Grab user's all unconfirmed mails
+               if (EXT_IS_ACTIVE("bonus"))
+               {
+                       // Load bonus ID
+                       $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d ORDER BY id",
+                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+               }
+                else
+               {
+                       // Load stats ID (2nd will be ignored later! But it is needed for the same fetchrow command)
+                       $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d ORDER BY id",
+                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+               }
+
+               $nums = bigintval(SQL_NUMROWS($result));
+               if ($nums > 0)
+               {
+                       // Some unconfirmed mails left
+                       if ($_GET['del'] == "all")
+                       {
+                               // Delete all unconfirmed mails by this user
+                               $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d LIMIT %s",
+                                array(bigintval($_GET['u_id']), $nums), __FILE__, __LINE__);
+
+                               // Prepare mail and send it away
+                               $msg = LOAD_EMAIL_TEMPLATE("admin-del_links", $nums, bigintval($_GET['u_id']));
+                               SEND_EMAIL($email, ADMIN_DEL_LINK_SUBJ, $msg);
+
+                               // Display message
+                               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LINKS_DELETED);
+                       }
+                        else
+                       {
+                               // List all unconfirmed mails
+                               $SW = 2; $OUT = "";
+                               while (list($id, $id2, $type) = SQL_FETCHROW($result))
+                               {
+                                       // Load data from stats table...
+                                       $cat = "";
+                                       switch ($type)
+                                       {
+                                       case "NORMAL":
+                                               $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%d LIMIT 1",
+                                                array(bigintval($id)), __FILE__, __LINE__);
+                                               $TYPE = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM;
+                                               $LINK = "<A href=\"".URL."/mailid.php?uid=".$_GET['u_id']."&amp;mailid=".$id."\" target=\"_blank\">".$id."</A>";
+                                               break;
+
+                                       case "BONUS":
+                                               $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM "._MYSQL_PREFIX."_bonus WHERE id=%d LIMIT 1",
+                                                array(bigintval($id2)), __FILE__, __LINE__);
+                                               $TYPE = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM;
+                                               $LINK = "<A href=\"".URL."/mailid.php?uid=".$_GET['u_id']."&amp;bonusid=".$id2."\" target=\"_blank\">".$id2."</A>";
+                                               break;
+                                       }
+
+                                       if (SQL_NUMROWS($result_data) == 1)
+                                       {
+                                               // Mail was found!
+                                               list($subject, $timestamp, $cat) = SQL_FETCHROW($result_data);
+                                               SQL_FREERESULT($result_data);
+                                               if (empty($subject)) $subject = DEFAULT_SUBJECT_LINE;
+
+                                               // Prepare data for the row template
+                                               $content = array(
+                                                       'sw'    => $SW,
+                                                       'link'  => $LINK,
+                                                       'subj'  => $subject,
+                                                       'stamp' => MAKE_DATETIME($timestamp, "0"),
+                                                       'cat'   => GET_CATEGORY($cat),
+                                               );
+
+                                               // Load row template
+                                               $OUT .= LOAD_TEMPLATE("admin_list_links_row", true, $content);
+                                       }
+                                        else
+                                       {
+                                               $OUT .= "<TR>
+  <TD align=\"center\" class=\"switch_sw".$SW." bottom2\" colspan=\"4\">
+    <STRONG class=\"member_failed large\">".$PROBLEM.":</STRONG> ".$DATA."
+  </TD>
+</TR>\n";
+                                       }
+                                       $SW = 3 - $SW;
+                               }
+
+                               // Free memory
+                               SQL_FREERESULT($result);
+
+                               // Remember list in constant for the template
+                               define('__SNAME_VALUE', $sname);
+                               define('__FNAME_VALUE', $fname);
+                               define('__EMAIL_VALUE', "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>");
+                               define('__EMAIL_LIST' , $OUT);
+                               define('__NUMS_VALUE' , $nums);
+                               define('__UID_VALUE'  , $_GET['u_id']);
+
+                               // Load final template
+                               LOAD_TEMPLATE("admin_list_links");
+                       }
+               }
+                else
+               {
+                       // No mails left to confirm
+                       LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_LINKS_1.$_GET['u_id'].ADMIN_MEMBER_LINKS_2);
+               }
+       }
+        else
+       {
+               // User not found
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2);
+       }
+}
+ else
+{
+       // Output selection form with all confirmed user accounts listed
+       ADD_MEMBER_SELECTION_BOX();
+}
+CLOSE_TABLE();
+
+//
+?>