More other options moved out (to config_order)
[mailer.git] / inc / modules / admin / what-config_home.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 09/22/2004 *
4  * ================                             Last change: 09/22/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_home.php                             *
8  * -------------------------------------------------------------------- *
9  * Short description : Set "home" page                                  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : "Home"-Seite festlegen                           *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
42
43 $sub = "";
44 if (!empty($_GET['sub'])) $sub = $_GET['sub'];
45
46 switch ($sub)
47 {
48 case "": // Output selection table
49         LOAD_TEMPLATE("admin_config_home_main");
50         break;
51
52 case "settings": // Settings related to the index page
53         if (isset($_POST['ok']))
54         {
55                 // Save settings
56                 ADMIN_SAVE_SETTINGS($_POST);
57                 OUTPUT_HTML("<A href=\"".URL."/modules.php?module=admin&amp;what=config_home&amp;sub=settings\">".ADMIN_CONTINUE_TO_CONFIG."</A>");
58         }
59          else
60         {
61                 // Prepare data for the template
62                 $content = array_fill(-1, 60, "");
63                 $content[$_CONFIG['index_delay']] = " selected=\"selected\"";
64
65                 define('__INDEX_COOKIE_SELECTION', CREATE_TIME_SELECTIONS($_CONFIG['index_cookie'], "index_cookie", "YMWD"));
66                 LOAD_TEMPLATE("admin_config_home_settings", false, $content);
67         }
68         break;
69
70 case "target": // Set which what-file will be placed in home-page (only modules.php?module=index)
71         if (isset($_GET['home']))
72         {
73                 // Set new home
74                 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET index_home='%s' WHERE config=0 LIMIT 1", array($_GET['home']), __FILE__, __LINE__);
75                 $_CONFIG['index_home'] = $_GET['home'];
76         }
77
78         // Load all what menu points
79         $result = SQL_QUERY("SELECT id, what, title
80  FROM "._MYSQL_PREFIX."_guest_menu
81  WHERE action='main' AND what != '' AND locked='N'
82  ORDER BY sort", __FILE__, __LINE__);
83
84         $SW = 2; $OUT = ""; $atitle = "";
85         while (list($id, $wht, $wtitle) = SQL_FETCHROW($result))
86         {
87                 $LINK = "<A href=\"".URL."/modules.php?module=admin&amp;what=config_home&amp;sub=target&amp;home=".$wht."\">"._IS_NEW_HOME."</A>";
88                 if ($wht == $_CONFIG['index_home'])
89                 {
90                         // Is current home
91                         $LINK   = "<STRONG class=\"admin_note\">"._IS_CURRENT_HOME."</STRONG>";
92                         $atitle = "<STRONG class=\"admin_note\">".$atitle."</STRONG>";
93                         $wtitle = "<STRONG class=\"admin_note\">".$wtitle."</STRONG>";
94                 }
95
96                 // Add row...
97                 $OUT .= "<TR>
98           <TD class=\"switch_sw".$SW." bottom right\">&nbsp;".$id."</TD>
99           <TD class=\"switch_sw".$SW." bottom right\">&nbsp;".$wtitle."</TD>
100           <TD class=\"switch_sw".$SW." bottom\" align=\"center\">
101             ".$LINK."
102           </TD>
103         </TR>\n";
104
105                 // Switch color
106                 $SW = 3 - $SW;
107         }
108
109         // Free memory
110         SQL_FREERESULT($result);
111         define('__HOME_ROWS', $OUT);
112
113         // Load template
114         LOAD_TEMPLATE("admin_config_home");
115         break;
116 }
117 //
118 ?>