(no commit message)
[mailer.git] / 0.2.1 / inc / modules / admin / what-list_bank_package.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 02/12/2004 *\r
4  * ================                             Last change: 02/12/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-list_bank_package.php                       *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : List packages                                    *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Listet Angebotspakete auf                        *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2007 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\r
18  * This program is free software; you can redistribute it and/or modify *\r
19  * it under the terms of the GNU General Public License as published by *\r
20  * the Free Software Foundation; either version 2 of the License, or    *\r
21  * (at your option) any later version.                                  *\r
22  *                                                                      *\r
23  * This program is distributed in the hope that it will be useful,      *\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
26  * GNU General Public License for more details.                         *\r
27  *                                                                      *\r
28  * You should have received a copy of the GNU General Public License    *\r
29  * along with this program; if not, write to the Free Software          *\r
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
31  * MA  02110-1301  USA                                                  *\r
32  ************************************************************************/\r
33 \r
34 // Some security stuff...\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {\r
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
37         require($INC);\r
38 }\r
39 \r
40 // Add description as navigation point\r
41 ADD_DESCR("admin", basename(__FILE__));\r
42 \r
43 // Check if there is enougth selected\r
44 $show = true;\r
45 if ((isset($_POST['id'])) && (is_array($_POST['id'])) && (count($_POST['id']) > 0)) {\r
46         // Okay, which button was pressed?\r
47         if (isset($_POST['change'])) {\r
48                 // Change permissions\r
49                 ADMIN_CHANGE_ACTIVATION_STATUS($_POST['id'], "bank_packages", "package_active");\r
50         } elseif (isset($_POST['delete'])) {\r
51                 // Delete entries (with confirmation)\r
52                 ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "bank_packages", "package_active", array("id", "title", "description", "account_fee"), array("bigintval", "", "", "TRANSLATE_COMMA"));\r
53                 $show = false;\r
54         } elseif (isset($_POST['remove'])) {\r
55                 // Delete entries (with confirmation)\r
56                 ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "bank_packages", "package_active", array(), array(), true);\r
57         }\r
58 }\r
59 \r
60 // Skip showing old entries?\r
61 if (!$show) return;\r
62 \r
63 // Load all banking packages from DB\r
64 $result = SQL_QUERY("SELECT id, title, description, account_fee AS 'fee', package_active AS 'active', interest_plus AS 'plus', interest_minus AS 'minus'\r
65 FROM "._MYSQL_PREFIX."_bank_packages\r
66 ORDER BY id", __FILE__, __LINE__);\r
67 \r
68 // Is there at lease one package?\r
69 if (SQL_NUMROWS($result) > 0) {\r
70         // List all packages\r
71         $OUT = ""; $SW = 2;\r
72         while ($content = SQL_FETCHARRAY($result)) {\r
73                 // "Translate" some data\r
74                 $content['active'] = TRANSLATE_YESNO($content['active']);\r
75                 $content['fee']    = TRANSLATE_COMMA($content['fee']);\r
76                 $content['plus']   = TRANSLATE_COMMA($content['plus']);\r
77                 $content['minus']  = TRANSLATE_COMMA($content['minus']);\r
78                 $content['sw']     = $SW;\r
79 \r
80                 // Load row template\r
81                 $OUT .= LOAD_TEMPLATE("admin_list_bank_package_row", true, $content);\r
82                 $SW = 3 - $SW;\r
83         }\r
84 \r
85         // Prepare row(s) for output to template\r
86         define('__BANK_PACKAGE_ROWS', $OUT);\r
87 \r
88         // Load main template\r
89         LOAD_TEMPLATE("admin_list_bank_package");\r
90 } else {\r
91         // No packages found!\r
92         LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BANK_NO_PACKAGES_FOUND);\r
93 }\r
94 \r
95 // Free the result\r
96 SQL_FREERESULT($result);\r
97 \r
98 //\r
99 ?>\r