Several more constants rewritten to getConfig()
[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  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 }
44
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
47
48 // Init 'sub' value
49 $sub = '';
50 if (REQUEST_ISSET_GET('sub')) $sub = REQUEST_GET('sub');
51
52 switch ($sub)
53 {
54         case "settings": // Settings related to the index page
55                 if (isFormSent()) {
56                         // Save settings
57                         ADMIN_SAVE_SETTINGS_POST();
58                         OUTPUT_HTML("<a href=\"{?URL?}/modules.php?module=admin&amp;what=config_home&amp;sub=settings\">{--ADMIN_CONTINUE_TO_CONFIG--}</a>");
59                 } else {
60                         // Prepare data for the template
61                         $content = array_fill(-1, 60, '');
62                         $content[getConfig('index_delay')] = ' selected="selected"';
63
64                         define('__INDEX_COOKIE_SELECTION', createTimeSelections(getConfig('index_cookie'), "index_cookie", "YMWD"));
65                         LOAD_TEMPLATE("admin_config_home_settings", false, $content);
66                 }
67                 break;
68
69         case "target": // Set which what-file will be placed in home-page (only modules.php?module=index)
70                 if (REQUEST_ISSET_GET(('home'))) {
71                         // Set new home
72                         updateConfiguration('index_home', REQUEST_GET(('home')));
73                 } // END - if
74
75                 // Load all what menu points
76                 $result = SQL_QUERY("SELECT id, what, title
77 FROM `{!_MYSQL_PREFIX!}_guest_menu`
78 WHERE `action`='main' AND `what` != '' AND `what` IS NOT NULL AND `locked`='N'
79 ORDER BY `sort` ASC", __FILE__, __LINE__);
80
81                 // Init variables
82                 $SW = 2;
83                 $OUT = '';
84
85                 // Process all entries
86                 while ($content = SQL_FETCHARRAY($result)) {
87                         // Link for setting 'what' as new "home"
88                         $LINK = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=config_home&amp;sub=target&amp;home=".$content['what']."\">{--_IS_NEW_HOME--}</a>";
89
90                         // Is this current home?
91                         if ($content['what'] == getConfig('index_home')) {
92                                 // Is current home
93                                 $LINK = "<div class=\"admin_note\">{!_IS_CURRENT_HOME!}</div>";
94                                 $content['title'] = "<div class=\"admin_note\">".$content['title']."</div>";
95                         } // END - if
96
97                         // Prepare content
98                         $content['sw'] = $SW;
99                         $content['link'] = $LINK;
100
101                         // Load row template
102                         $OUT .= LOAD_TEMPLATE("admin_config_home_row", true, $content);
103
104                         // Switch color
105                         $SW = 3 - $SW;
106                 } // END - while
107
108                 // Free memory
109                 SQL_FREERESULT($result);
110                 define('__HOME_ROWS', $OUT);
111
112                 // Load template
113                 LOAD_TEMPLATE("admin_config_home");
114                 break;
115
116         default: // Output selection table
117                 LOAD_TEMPLATE("admin_config_home_main");
118                 break;
119
120 }
121
122 //
123 ?>