2bd570a31549c9af96ca5920829c42a789f52ec7
[mailer.git] / 0.2.1 / inc / modules / admin / what-config_home.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 09/22/2004 *\r
4  * ================                             Last change: 09/22/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-config_home.php                             *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Set "home" page                                  *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : "Home"-Seite festlegen                           *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 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 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
38         require($INC);\r
39 }\r
40 // Add description as navigation point\r
41 ADD_DESCR("admin", basename(__FILE__));\r
42 \r
43 $sub = "";\r
44 if (!empty($_GET['sub'])) $sub = $_GET['sub'];\r
45 \r
46 switch ($sub)\r
47 {\r
48 case "": // Output selection table\r
49         LOAD_TEMPLATE("admin_config_home_main");\r
50         break;\r
51 \r
52 case "settings": // Settings related to the index page\r
53         if (isset($_POST['ok']))\r
54         {\r
55                 // Save settings\r
56                 ADMIN_SAVE_SETTINGS($_POST, "_config", "config='0'");\r
57                 OUTPUT_HTML ("<A href=\"".URL."/modules.php?module=admin&amp;what=config_home&amp;sub=settings\">".ADMIN_CONTINUE_TO_CONFIG."</A>");\r
58         }\r
59          else\r
60         {\r
61                 // Prepare data for the template\r
62                 $content = array_fill(-1, 60, "");\r
63                 $content[$CONFIG['index_delay']] = " selected=\"selected\"";\r
64 \r
65                 define('__INDEX_COOKIE_SELECTION', CREATE_TIME_SELECTIONS($CONFIG['index_cookie'], "index_cookie", "YMWD"));\r
66                 LOAD_TEMPLATE("admin_config_home_settings", false, $content);\r
67         }\r
68         break;\r
69 \r
70 case "target": // Set which what-file will be placed in home-page (only modules.php?module=index)\r
71         if (isset($_GET['home']))\r
72         {\r
73                 // Set new home\r
74                 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET index_home='%s' WHERE config='0' LIMIT 1", array($_GET['home']), __FILE__, __LINE__);\r
75                 $CONFIG['index_home'] = $_GET['home'];\r
76         }\r
77 \r
78         // Load all what menu points\r
79         $result = SQL_QUERY("SELECT id, what, title\r
80  FROM "._MYSQL_PREFIX."_guest_menu\r
81  WHERE action='main' AND what != '' AND locked='N'\r
82  ORDER BY sort", __FILE__, __LINE__);\r
83 \r
84         $SW = 2; $OUT = ""; $atitle = "";\r
85         while (list($id, $wht, $wtitle) = SQL_FETCHROW($result))\r
86         {\r
87                 $LINK = "<A href=\"".URL."/modules.php?module=admin&amp;what=config_home&amp;sub=target&amp;home=".$wht."\">"._IS_NEW_HOME."</A>";\r
88                 if ($wht == $CONFIG['index_home'])\r
89                 {\r
90                         // Is current home\r
91                         $LINK   = "<STRONG class=\"admin_note\">"._IS_CURRENT_HOME."</STRONG>";\r
92                         $atitle = "<STRONG class=\"admin_note\">".$atitle."</STRONG>";\r
93                         $wtitle = "<STRONG class=\"admin_note\">".$wtitle."</STRONG>";\r
94                 }\r
95 \r
96                 // Add row...\r
97                 $OUT .= "<TR>\r
98           <TD class=\"switch_sw".$SW." bottom right\">&nbsp;".$id."</TD>\r
99           <TD class=\"switch_sw".$SW." bottom right\">&nbsp;".$wtitle."</TD>\r
100           <TD class=\"switch_sw".$SW." bottom\" align=\"center\">\r
101             ".$LINK."\r
102           </TD>\r
103         </TR>\n";\r
104 \r
105                 // Switch color\r
106                 $SW = 3 - $SW;\r
107         }\r
108 \r
109         // Free memory\r
110         SQL_FREERESULT($result);\r
111         define('__HOME_ROWS', $OUT);\r
112 \r
113         // Load template\r
114         LOAD_TEMPLATE("admin_config_home");\r
115         break;\r
116 }\r
117 //\r
118 ?>\r