Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
commit | author | age
4eb8d2 1 <?php
C 2
3 /*
4 Copyright (c) 2005, Till Brehm, projektfarm Gmbh
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9
10     * Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12     * Redistributions in binary form must reproduce the above copyright notice,
13       this list of conditions and the following disclaimer in the documentation
14       and/or other materials provided with the distribution.
15     * Neither the name of ISPConfig nor the names of its contributors
16       may be used to endorse or promote products derived from this software without
17       specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 /*
32     Form Definition
33
34     Tabellendefinition
35
36     Datentypen:
37     - INTEGER (Wandelt Ausdr�cke in Int um)
38     - DOUBLE
39     - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
40     - VARCHAR (kein weiterer Format Check)
41     - TEXT (kein weiterer Format Check)
42     - DATE (Datumsformat, Timestamp Umwandlung)
43
44     Formtype:
45     - TEXT (normales Textfeld)
46     - TEXTAREA (normales Textfeld)
47     - PASSWORD (Feldinhalt wird nicht angezeigt)
48     - SELECT (Gibt Werte als option Feld aus)
49     - RADIO
50     - CHECKBOX
51     - CHECKBOXARRAY
52     - FILE
53
54     VALUE:
55     - Wert oder Array
56
57     Hinweis:
58     Das ID-Feld ist nicht bei den Table Values einzuf�gen.
59
60
61 */
62
b1a6a5 63 $form['title']   = 'interface_head_txt';
MC 64 $form['description']  = 'interface_desc_txt';
65 $form['name']   = 'interface';
66 $form['action']  = 'interface_settings.php';
67 $form['db_table'] = 'sys_user';
68 $form['db_table_idx'] = 'userid';
69 $form["db_history"] = "no";
70 $form['tab_default'] = 'main';
71 $form['list_default'] = 'index.php';
72 $form['auth']  = 'no'; //??
4eb8d2 73
C 74 //* 0 = id of the user, > 0 id must match with id of current user
b1a6a5 75 $form['auth_preset']['userid']  = 0;
4eb8d2 76 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
b1a6a5 77 $form['auth_preset']['groupid'] = 0;
4eb8d2 78
C 79 //** Permissions are: r = read, i = insert, u = update, d = delete
80 $form['auth_preset']['perm_user']  = 'riud';
81 $form['auth_preset']['perm_group'] = 'riud';
82 $form['auth_preset']['perm_other'] = '';
83
84 //* Pick out modules
85 //* TODO: limit to activated modules of the user
86 $modules_list = array();
e88a7a 87 if($_SESSION["s"]["user"]["typ"] == 'admin') {
b1a6a5 88     $handle = @opendir(ISPC_WEB_PATH);
MC 89     while ($file = @readdir($handle)) {
e88a7a 90         if ($file != '.' && $file != '..') {
T 91             if(@is_dir(ISPC_WEB_PATH."/$file")) {
92                 if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
93                     $modules_list[$file] = $file;
94                 }
4eb8d2 95             }
e88a7a 96         }
T 97     }
98 } else {
cc7a82 99     $tmp = $app->db->queryOneRecord("SELECT * FROM sys_user where username = ?", $_SESSION["s"]["user"]['username']);
cc6568 100     $modules = $tmp['modules'];
H 101     //$modules = $conf['interface_modules_enabled'];
e88a7a 102     if($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
T 103         $modules .= ',client';
104     }
b1a6a5 105     $tmp = explode(',', $modules);
e88a7a 106     foreach($tmp as $m) {
T 107         $modules_list[$m] = $m;
4eb8d2 108     }
C 109 }
110
111 //* Languages
112 $language_list = array();
b1a6a5 113 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
MC 114 while ($file = @readdir($handle)) {
115     if ($file != '.' && $file != '..') {
116         if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
4eb8d2 117             $tmp = substr($file, 0, 2);
C 118             $language_list[$tmp] = $tmp;
b1a6a5 119         }
4eb8d2 120     }
b1a6a5 121 }
4eb8d2 122
C 123 //* Load themes
124 $themes_list = array();
b1a6a5 125 $handle = @opendir(ISPC_THEMES_PATH);
MC 126 while ($file = @readdir($handle)) {
127     if (substr($file, 0, 1) != '.') {
128         if(@is_dir(ISPC_THEMES_PATH."/$file")) {
4bd960 129             if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
b1a6a5 130                 $themes_list[$file] = $file;
MC 131             }
132         }
4eb8d2 133     }
C 134 }
135
136 $form['tabs']['main'] = array (
b1a6a5 137     'title'  => 'Settings',
MC 138     'width'  => 80,
139     'template'  => 'templates/interface_settings.htm',
140     'fields'  => array (
141         //#################################
142         // Beginn Datenbankfelder
143         //#################################
144         'startmodule' => array (
145             'datatype' => 'VARCHAR',
146             'formtype' => 'SELECT',
147             'regex'  => '',
148             'errmsg' => '',
149             'default' => '',
150             'value'  => $modules_list,
151             'separator' => '',
152             'width'  => '30',
153             'maxlength' => '255',
154             'rows'  => '',
155             'cols'  => ''
4eb8d2 156         ),
b1a6a5 157         'app_theme' => array (
MC 158             'datatype' => 'VARCHAR',
159             'formtype' => 'SELECT',
160             'regex' => '',
161             'errmsg' => '',
162             'default' => 'default',
163             'value' => $themes_list,
164             'separator' => '',
165             'width' => '30',
166             'maxlength' => '255',
167             'rows' => '',
168             'cols' => ''
169         )
170         //#################################
171         // ENDE Datenbankfelder
172         //#################################
4eb8d2 173     )
C 174 );
175
176
177 ?>