win32 to unix line delimiters changed
[mailer.git] / 0.2.1 / inc / modules / admin / what-lock_user.php
index 954e9dd6b7840ba48e7c21e61c3125736c46e04f..d2e1fd48fbb58368cb36371178fa95415372f4ff 100644 (file)
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1                                    Start: 09/28/2003 *\r
- * ===============                              Last change: 06/10/2004 *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * File              : what-lock_user.php                               *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Lock members                                     *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung  : Mitglieder sperren                               *\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
-OPEN_TABLE("100%", "admin_content admin_content_align", "");\r
-if (!empty($_GET['u_id']))\r
-{\r
-       $result_user = SQL_QUERY_ESC("SELECT status, sex, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",\r
-        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-       $ACT = false;\r
-       if (SQL_NUMROWS($result_user) == 1)\r
-       {\r
-               // User found\r
-               list($status, $sex, $sname, $fname, $email) = SQL_FETCHROW($result_user);\r
-               SQL_FREERESULT($result_user);\r
-               if (empty($_GET['u_id']))\r
-               {\r
-                       // Output selection form with all confirmed user accounts listed\r
-                       ADD_MEMBER_SELECTION_BOX();\r
-               }\r
-                elseif (!empty($_POST['lock']))\r
-               {\r
-                       // Ok, lock the account!\r
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET status='LOCKED' WHERE userid=%d LIMIT 1",\r
-                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-                       if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1)\r
-                       {\r
-                               // Send an email to the user! In later version you can optionally switch this feature off\r
-                               $msg = LOAD_EMAIL_TEMPLATE("lock-user", stripslashes($_POST['reason']), $_GET['u_id']);\r
-\r
-                               // Send away...\r
-                               SEND_EMAIL($email, ADMIN_LOCKED_SUBJ, $msg);\r
-                       }\r
-\r
-                       // Prepare message\r
-                       $MSG = USER_ACCOUNT_LOCKED_1.$_GET['u_id'].USER_ACCOUNT_LOCKED_2;\r
-                       $ACT = true;\r
-               }\r
-                elseif (!empty($_POST['unlock']))\r
-               {\r
-                       // Ok, unlock the account!\r
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET status='CONFIRMED' WHERE userid=%d LIMIT 1",\r
-                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-                       if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1)\r
-                       {\r
-                               // Send an email to the user! In later version you can optionally switch this feature off\r
-                               $msg = LOAD_EMAIL_TEMPLATE("unlock-user", stripslashes($_POST['reason']), $_GET['u_id']);\r
-\r
-                               // Send away...\r
-                               SEND_EMAIL($email, ADMIN_UNLOCKED_SUBJ, $msg);\r
-                               if (EXT_IS_ACTIVE("rallye"))\r
-                               {\r
-                                       RALLYE_AUTOADD_USER($_GET['u_id']);\r
-                               }\r
-                       }\r
-\r
-                       // Prepare message\r
-                       $MSG = USER_ACCOUNT_UNLOCKED_1.$_GET['u_id'].USER_ACCOUNT_UNLOCKED_2;\r
-                       $ACT = true;\r
-               }\r
-                elseif (isset($_POST['del']))\r
-               {\r
-                       // Delete the account\r
-                       $ACT = true;\r
-                       require_once(PATH."inc/modules/admin/what-del_user.php");\r
-               }\r
-                elseif (!empty($_POST['no']))\r
-               {\r
-                       // Do not lock him...\r
-                       $URL = URL."/modules.php?module=admin&amp;what=list_user&amp;u_id=".$_GET['u_id'];\r
-               }\r
-                else\r
-               {\r
-                       $result = SQL_QUERY_ESC("SELECT email, surname, family 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
-                               // Load data\r
-                               list ($email, $sname, $fname) = SQL_FETCHROW($result);\r
-                               SQL_FREERESULT($result);\r
-\r
-                               // Transfer data to constants for the template\r
-                               define('__EMAIL', CREATE_EMAIL_LINK($email, "user_data"));\r
-                               define('__SNAME', $sname);\r
-                               define('__FNAME', $fname);\r
-                               define('__UID'  , $_GET['u_id']);\r
-\r
-                               // Transfer data to constants for the template\r
-                               define('__UID_VALUE', $_GET['u_id']);\r
-\r
-                               // Realy want to lock?\r
-                               switch ($status)\r
-                               {\r
-                               case "CONFIRMED": // Yes, lock him down... ;-)\r
-                                       define('__OK_VALUE'    , "lock");\r
-                                       define('__HEADER_VALUE', ADMIN_HEADER_LOCK_ACCOUNT_1.__UID_VALUE.ADMIN_HEADER_LOCK_ACCOUNT_2);\r
-                                       define('__TEXT_VALUE'  , ADMIN_TEXT_LOCK_ACCOUNT_1.__UID_VALUE.ADMIN_TEXT_LOCK_ACCOUNT_2);\r
-                                       break;\r
-\r
-                               case "LOCKED": // Unlock the user\r
-                                       define('__OK_VALUE'    , "unlock");\r
-                                       define('__HEADER_VALUE', ADMIN_HEADER_UNLOCK_ACCOUNT_1.__UID_VALUE.ADMIN_HEADER_UNLOCK_ACCOUNT_2);\r
-                                       define('__TEXT_VALUE'  , ADMIN_TEXT_UNLOCK_ACCOUNT_1.__UID_VALUE.ADMIN_TEXT_UNLOCK_ACCOUNT_2);\r
-                                       break;\r
-\r
-                               case "UNCONFIRMED": // Unconfirmed accounts cannot be unlocked!\r
-                                       define('__OK_VALUE'    , "del");\r
-                                       define('__HEADER_VALUE', ADMIN_HEADER_DEL_ACCOUNT_1.__UID_VALUE.ADMIN_HEADER_DEL_ACCOUNT_2);\r
-                                       define('__TEXT_VALUE'  , ADMIN_TEXT_DEL_ACCOUNT_1.__UID_VALUE.ADMIN_TEXT_DEL_ACCOUNT_2);\r
-                                       break;\r
-                               }\r
-\r
-                               // Output form\r
-                               LOAD_TEMPLATE("admin_lock_user");\r
-                       }\r
-                        else\r
-                       {\r
-                               // Account does not exists!\r
-                               OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");\r
-                       }\r
-               }\r
-               if (!empty($URL))\r
-               {\r
-                       // Reload and die...\r
-                       LOAD_URL($URL);\r
-               }\r
-                elseif ($ACT)\r
-               {\r
-                       // An action was performed...\r
-                       if (!empty($MSG))\r
-                       {\r
-                               LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG class=\"admin_green\">".$MSG."</STRONG>");\r
-                       }\r
-                        else\r
-                       {\r
-                               LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG class=\"admin_green\">".ADMIN_USER_UPDATED."</STRONG>");\r
-                       }\r
-               }\r
-       }\r
-        else\r
-       {\r
-               // Account does not exists!\r
-               OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");\r
-       }\r
-}\r
- else\r
-{\r
-       // List all users\r
-       ADD_MEMBER_SELECTION_BOX();\r
-}\r
-CLOSE_TABLE();\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/28/2003 *
+ * ===============                              Last change: 06/10/2004 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-lock_user.php                               *
+ * -------------------------------------------------------------------- *
+ * Short description : Lock members                                     *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Mitglieder sperren                               *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * 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__));
+
+OPEN_TABLE("100%", "admin_content admin_content_align", "");
+if (!empty($_GET['u_id']))
+{
+       $result_user = SQL_QUERY_ESC("SELECT status, sex, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+       $ACT = false;
+       if (SQL_NUMROWS($result_user) == 1)
+       {
+               // User found
+               list($status, $sex, $sname, $fname, $email) = SQL_FETCHROW($result_user);
+               SQL_FREERESULT($result_user);
+               if (empty($_GET['u_id']))
+               {
+                       // Output selection form with all confirmed user accounts listed
+                       ADD_MEMBER_SELECTION_BOX();
+               }
+                elseif (!empty($_POST['lock']))
+               {
+                       // Ok, lock the account!
+                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET status='LOCKED' WHERE userid=%d LIMIT 1",
+                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+                       if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1)
+                       {
+                               // Send an email to the user! In later version you can optionally switch this feature off
+                               $msg = LOAD_EMAIL_TEMPLATE("lock-user", stripslashes($_POST['reason']), $_GET['u_id']);
+
+                               // Send away...
+                               SEND_EMAIL($email, ADMIN_LOCKED_SUBJ, $msg);
+                       }
+
+                       // Prepare message
+                       $MSG = USER_ACCOUNT_LOCKED_1.$_GET['u_id'].USER_ACCOUNT_LOCKED_2;
+                       $ACT = true;
+               }
+                elseif (!empty($_POST['unlock']))
+               {
+                       // Ok, unlock the account!
+                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET status='CONFIRMED' WHERE userid=%d LIMIT 1",
+                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+                       if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1)
+                       {
+                               // Send an email to the user! In later version you can optionally switch this feature off
+                               $msg = LOAD_EMAIL_TEMPLATE("unlock-user", stripslashes($_POST['reason']), $_GET['u_id']);
+
+                               // Send away...
+                               SEND_EMAIL($email, ADMIN_UNLOCKED_SUBJ, $msg);
+                               if (EXT_IS_ACTIVE("rallye"))
+                               {
+                                       RALLYE_AUTOADD_USER($_GET['u_id']);
+                               }
+                       }
+
+                       // Prepare message
+                       $MSG = USER_ACCOUNT_UNLOCKED_1.$_GET['u_id'].USER_ACCOUNT_UNLOCKED_2;
+                       $ACT = true;
+               }
+                elseif (isset($_POST['del']))
+               {
+                       // Delete the account
+                       $ACT = true;
+                       require_once(PATH."inc/modules/admin/what-del_user.php");
+               }
+                elseif (!empty($_POST['no']))
+               {
+                       // Do not lock him...
+                       $URL = URL."/modules.php?module=admin&amp;what=list_user&amp;u_id=".$_GET['u_id'];
+               }
+                else
+               {
+                       $result = SQL_QUERY_ESC("SELECT email, surname, family FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+                        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+                       if (SQL_NUMROWS($result) == 1)
+                       {
+                               // Load data
+                               list ($email, $sname, $fname) = SQL_FETCHROW($result);
+                               SQL_FREERESULT($result);
+
+                               // Transfer data to constants for the template
+                               define('__EMAIL', CREATE_EMAIL_LINK($email, "user_data"));
+                               define('__SNAME', $sname);
+                               define('__FNAME', $fname);
+                               define('__UID'  , $_GET['u_id']);
+
+                               // Transfer data to constants for the template
+                               define('__UID_VALUE', $_GET['u_id']);
+
+                               // Realy want to lock?
+                               switch ($status)
+                               {
+                               case "CONFIRMED": // Yes, lock him down... ;-)
+                                       define('__OK_VALUE'    , "lock");
+                                       define('__HEADER_VALUE', ADMIN_HEADER_LOCK_ACCOUNT_1.__UID_VALUE.ADMIN_HEADER_LOCK_ACCOUNT_2);
+                                       define('__TEXT_VALUE'  , ADMIN_TEXT_LOCK_ACCOUNT_1.__UID_VALUE.ADMIN_TEXT_LOCK_ACCOUNT_2);
+                                       break;
+
+                               case "LOCKED": // Unlock the user
+                                       define('__OK_VALUE'    , "unlock");
+                                       define('__HEADER_VALUE', ADMIN_HEADER_UNLOCK_ACCOUNT_1.__UID_VALUE.ADMIN_HEADER_UNLOCK_ACCOUNT_2);
+                                       define('__TEXT_VALUE'  , ADMIN_TEXT_UNLOCK_ACCOUNT_1.__UID_VALUE.ADMIN_TEXT_UNLOCK_ACCOUNT_2);
+                                       break;
+
+                               case "UNCONFIRMED": // Unconfirmed accounts cannot be unlocked!
+                                       define('__OK_VALUE'    , "del");
+                                       define('__HEADER_VALUE', ADMIN_HEADER_DEL_ACCOUNT_1.__UID_VALUE.ADMIN_HEADER_DEL_ACCOUNT_2);
+                                       define('__TEXT_VALUE'  , ADMIN_TEXT_DEL_ACCOUNT_1.__UID_VALUE.ADMIN_TEXT_DEL_ACCOUNT_2);
+                                       break;
+                               }
+
+                               // Output form
+                               LOAD_TEMPLATE("admin_lock_user");
+                       }
+                        else
+                       {
+                               // Account does not exists!
+                               OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");
+                       }
+               }
+               if (!empty($URL))
+               {
+                       // Reload and die...
+                       LOAD_URL($URL);
+               }
+                elseif ($ACT)
+               {
+                       // An action was performed...
+                       if (!empty($MSG))
+                       {
+                               LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG class=\"admin_green\">".$MSG."</STRONG>");
+                       }
+                        else
+                       {
+                               LOAD_TEMPLATE("admin_settings_saved", false, "<STRONG class=\"admin_green\">".ADMIN_USER_UPDATED."</STRONG>");
+                       }
+               }
+       }
+        else
+       {
+               // Account does not exists!
+               OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");
+       }
+}
+ else
+{
+       // List all users
+       ADD_MEMBER_SELECTION_BOX();
+}
+CLOSE_TABLE();
+//
+?>