Global rewrite of engine:
[mailer.git] / inc / modules / admin / what-config_home.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                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 - 2009 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')) || (!isAdmin())) {
41         die();
42 }
43
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
46
47 // Init 'sub' value
48 $sub = '';
49 if (isGetRequestElementSet('sub')) $sub = getRequestElement('sub');
50
51 switch ($sub) {
52         case 'settings': // Settings related to the index page
53                 if (isFormSent()) {
54                         // Save settings
55                         adminSaveSettingsFromPostData();
56
57                         // Display continue link
58                         loadTemplate('admin_settings_saved', false, "<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                         // Generate selection
65                         $content['cookie_selection'] = createTimeSelections(getConfig('index_cookie'), 'index_cookie', 'YMWD');
66
67                         // Output form
68                         loadTemplate('admin_config_home_settings', false, $content);
69                 }
70                 break;
71
72         case 'target': // Set which what-file will be placed in home-page (only modules.php?module=index)
73                 if (isGetRequestElementSet(('home'))) {
74                         // Set new home
75                         updateConfiguration('index_home', getRequestElement(('home')));
76                 } // END - if
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 `what` IS NOT NULL AND `locked`='N'
82 ORDER BY `sort` ASC", __FILE__, __LINE__);
83
84                 // Init variables
85                 $SW = 2;
86                 $OUT = '';
87
88                 // Process all entries
89                 while ($content = SQL_FETCHARRAY($result)) {
90                         // Link for setting 'what' as new "home"
91                         $newHomeLink = "<a href=\"{%url=modules.php?module=admin&amp;what=config_home&amp;sub=target&amp;home=" . $content['what'] . "%}\">{--_IS_NEW_HOME--}</a>";
92
93                         // Is this current home?
94                         if ($content['what'] == getConfig('index_home')) {
95                                 // Is current home
96                                 $newHomeLink      = "<div class=\"admin_mark\">{--_IS_CURRENT_HOME--}</div>";
97                                 $content['title'] = "<div class=\"admin_mark\">" . $content['title'] . "</div>";
98                         } // END - if
99
100                         // Prepare content
101                         $content['sw'] = $SW;
102                         $content['link'] = $newHomeLink;
103
104                         // Load row template
105                         $OUT .= loadTemplate('admin_config_home_row', true, $content);
106
107                         // Switch color
108                         $SW = 3 - $SW;
109                 } // END - while
110
111                 // Free memory
112                 SQL_FREERESULT($result);
113
114                 // Load template
115                 loadTemplate('admin_config_home', false, $OUT);
116                 break;
117
118         default: // Output selection table
119                 loadTemplate('admin_config_home_main');
120                 break;
121
122 }
123
124 // [EOF]
125 ?>