1+ <?php
2+ /*
3+ Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
4+ All rights reserved.
5+
6+ Redistribution and use in source and binary forms, with or without modification,
7+ are permitted provided that the following conditions are met:
8+
9+ * Redistributions of source code must retain the above copyright notice,
10+ this list of conditions and the following disclaimer.
11+ * Redistributions in binary form must reproduce the above copyright notice,
12+ this list of conditions and the following disclaimer in the documentation
13+ and/or other materials provided with the distribution.
14+ * Neither the name of ISPConfig nor the names of its contributors
15+ may be used to endorse or promote products derived from this software without
16+ specific prior written permission.
17+
18+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+ IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+ */
29+
30+ require_once ('../../lib/config.inc.php ' );
31+ require_once ('../../lib/app.inc.php ' );
32+
33+ //* Check permissions for module
34+ $ app ->auth ->check_module_permissions ('dashboard ' );
35+
36+ //* Loading Template
37+ $ app ->uses ('tpl ' );
38+ $ app ->tpl ->newTemplate ("templates/dashboard.htm " );
39+
40+ //* load language file
41+ $ lng_file = 'lib/lang/ ' .$ _SESSION ['s ' ]['language ' ].'.lng ' ;
42+ include ($ lng_file );
43+ $ app ->tpl ->setVar ($ wb );
44+
45+ //* set Default - Values
46+ $ app ->tpl_defaults ();
47+
48+ /*
49+ * Let the user welcome
50+ */
51+ $ welcome = sprintf ($ wb ['welcome_user_txt ' ], $ _SESSION ['s ' ]['user ' ]['username ' ]);
52+ $ app ->tpl ->setVar ('welcome_user ' , $ welcome );
53+
54+
55+ /*
56+ * ToDo: Display errors, warnings and hints
57+ */
58+ ///*
59+ // * If there is any error to display, do it...
60+ //*/
61+ //$error = array();
62+ //
63+ //$error[] = array('error_msg' => 'EClaus1');
64+ //$error[] = array('error_msg' => 'EEClaus2');
65+ //$error[] = array('error_msg' => 'EClaus3');
66+ //$error[] = array('error_msg' => 'EClaus4');
67+ //
68+ //$app->tpl->setloop('error', $error);
69+ //
70+ ///*
71+ // * If there is any warning to display, do it...
72+ //*/
73+ //$warning = array();
74+ //
75+ //$warning[] = array('warning_msg' => 'WClaus1');
76+ //$warning[] = array('warning_msg' => 'WWClaus2');
77+ //$warning[] = array('warning_msg' => 'WClaus3');
78+ //$warning[] = array('warning_msg' => 'WClaus4');
79+ //
80+ //$app->tpl->setloop('warning', $warning);
81+ //
82+ ///*
83+ // * If there is any information to display, do it...
84+ //*/
85+ //$info = array();
86+ //
87+ //$info[] = array('info_msg' => 'IClaus1');
88+ //$info[] = array('info_msg' => 'IClaus2');
89+ //$info[] = array('info_msg' => 'IClaus3');
90+ //$info[] = array('info_msg' => 'IClaus4');
91+ //
92+ //$app->tpl->setloop('info', $info);
93+
94+ /*
95+ * Show all modules, the user is allowed to use
96+ */
97+ $ modules = explode (', ' , $ _SESSION ['s ' ]['user ' ]['modules ' ]);
98+ $ mod = array ();
99+ if (is_array ($ modules )) {
100+ foreach ($ modules as $ mt ) {
101+ if (is_file ('../ ' . $ mt . '/lib/module.conf.php ' )) {
102+ if (!preg_match ("/^[a-z]{2,20}$/i " , $ mt )) die ('module name contains unallowed chars. ' );
103+ include_once ('../ ' . $ mt .'/lib/module.conf.php ' );
104+ /* We don't want to show the dashboard */
105+ if ($ mt != 'dashboard ' ) {
106+ $ mod [] = array ( 'modules_title ' => $ app ->lng ($ module ['title ' ]),
107+ 'modules_startpage ' => $ module ['startpage ' ],
108+ 'modules_name ' => $ module ['name ' ]);
109+ }
110+ }
111+ }
112+
113+ $ app ->tpl ->setloop ('modules ' , $ mod );
114+ }
115+
116+ //* Do Output
117+ $ app ->tpl ->pparse ();
118+
119+ ?>
0 commit comments