Commit eb0645bb authored by tbrehm's avatar tbrehm
Browse files

- Global settings are configurable trough a form under admin > system > Interface Config

- Formatted error messages for better visibility.
parent 78f1a64e
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "System Config";
$form["description"] = "";
$form["name"] = "system_config";
$form["action"] = "system_config_edit.php";
$form["db_table"] = "sys_ini";
$form["db_table_idx"] = "sysini_id";
$form["db_history"] = "yes";
$form["tab_default"] = "sites";
$form["list_default"] = "users_list.php";
$form["auth"] = 'yes'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['sites'] = array (
'title' => "Sites",
'width' => 70,
'template' => "templates/system_config_sites_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
'dbname_prefix' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
'errmsg'=> 'dbname_prefix_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'dbuser_prefix' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
'errmsg'=> 'dbuser_prefix_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'ftpuser_prefix' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
'errmsg'=> 'ftpuser_prefix_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'shelluser_prefix' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
'errmsg'=> 'shelluser_prefix_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
##################################
# ENDE Datatable fields
##################################
)
);
?>
\ No newline at end of file
<?php
$wb['warning'] = 'Edit these values carefully! Do not remove the prefixes on a systems with more then one client.';
$wb['dbname_prefix_txt'] = 'Database name prefix';
$wb['dbuser_prefix_txt'] = 'Database user prefix';
$wb['shelluser_prefix_txt'] = 'Shell user prefix';
$wb['ftpuser_prefix_txt'] = 'FTP user prefix';
$wb['dbname_prefix_error_regex'] = 'Char not allowed in database name prefix.';
$wb['dbuser_prefix_error_regex'] = 'Char not allowed in database user prefix.';
$wb['ftpuser_prefix_error_regex'] = 'Char not allowed in ftp user prefix.';
$wb['shelluser_prefix_error_regex'] = 'Char not allowed in shell user prefix.';
?>
\ No newline at end of file
......@@ -64,7 +64,12 @@ $items[] = array( 'title' => 'Edit Server IP',
'target' => 'content',
'link' => 'admin/server_ip_list.php');
$module['nav'][] = array( 'title' => 'Servers',
$items[] = array( 'title' => 'Interface Config',
'target' => 'content',
'link' => 'admin/system_config_edit.php?id=1');
$module['nav'][] = array( 'title' => 'System',
'open' => 1,
'items' => $items);
// cleanup
......
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/system_config.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
function onShowEdit() {
global $app, $conf;
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
if($app->tform->errorMessage == '') {
$app->uses('ini_parser,getconf');
$section = $this->active_tab;
$server_id = $this->id;
$this->dataRecord = $app->getconf->get_global_config($section);
}
$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
$record['warning'] = $app->tform->lng('warning');
$record['id'] = $this->id;
$app->tpl->setVar($record);
}
function onUpdateSave($sql) {
global $app;
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
$app->uses('ini_parser,getconf');
$section = $app->tform->getCurrentTab();
$server_id = $this->id;
$server_config_array = $app->getconf->get_global_config($server_id);
$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
$sql = "UPDATE sys_ini SET config = '".$app->db->quote($server_config_str)."' WHERE sysini_id = 1";
$app->db->query($sql);
}
}
$app->tform_actions = new page_action;
$app->tform_actions->onLoad();
?>
\ No newline at end of file
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_system_config">
<div class="pnl_formsarea">
<fieldset id="wf_area_system_config"><legend>Sites</legend>
<p>{tmpl_var name='warning'}</p>
<span class="wf_oneField">
<label for="dbname_prefix" class="wf_preField">{tmpl_var name='dbname_prefix_txt'}</label>
<input type="text" id="dbname_prefix" name="dbname_prefix" value="{tmpl_var name='dbname_prefix'}" size="30" maxlength="255">
</span>
<span class="wf_oneField">
<label for="dbuser_prefix" class="wf_preField">{tmpl_var name='dbuser_prefix_txt'}</label>
<input type="text" id="dbuser_prefix" name="dbuser_prefix" value="{tmpl_var name='dbuser_prefix'}" size="30" maxlength="255">
</span>
<span class="wf_oneField">
<label for="ftpuser_prefix" class="wf_preField">{tmpl_var name='ftpuser_prefix_txt'}</label>
<input type="text" id="ftpuser_prefix" name="ftpuser_prefix" value="{tmpl_var name='ftpuser_prefix'}" size="30" maxlength="255">
</span>
<span class="wf_oneField">
<label for="shelluser_prefix" class="wf_preField">{tmpl_var name='shelluser_prefix_txt'}</label>
<input type="text" id="shelluser_prefix" name="shelluser_prefix" value="{tmpl_var name='shelluser_prefix'}" size="30" maxlength="255">
</span>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<div class="wf_actions buttons">
<button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/system_config_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
<button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/users_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
</div>
</div>
</div>
@charset "UTF-8";
/**
* "Yet Another Multicolumn Layout" - (X)HTML/CSS Framework
*
* (en) Uniform design of ISPConfig elements - ISPConfig 3: default theme
* (de) Einheitliche Standardformatierungen f�r ISPConfig-Elemente - ISPConfig 3: default theme
*
* @copyright Copyright 2005-2008, Dirk Jesse
* @license CC-A 2.0 (http://creativecommons.org/licenses/by/2.0/),
* YAML-C (http://www.yaml.de/en/license/license-conditions.html)
* @link http://www.yaml.de
* @package yaml
* @version 3.0.6
* @revision $Revision: 202 $
* @lastmodified $Date: 2008-06-07 14:29:18 +0200 (Sa, 07 Jun 2008) $
* @appdef yaml
*/
@media all
{
.pageForm_description {
font-size: 12px;
}
/* Tab-Box */
.tabbox_tabs {
border-bottom: 1px solid #d3d3d3;
}
.tabbox_tabs ul {
list-style: none;
padding: 0;
margin: 0;
}
.tabbox_tabs li {
display: inline;
margin: 0 2px 0 0;
}
.tabbox_tabs a {
padding: 0 1em;
text-decoration: none;
color: black;
background: #d3d3d3;
border: 1px solid #d3d3d3;
}
.tabbox_tabs a:hover {
background: #fc0;
color: #540;
}
.tabbox_tabs .active a {
font-weight: bold;
color: #ff6600;
background: #ffffff;
}
.pnl_toolsarea fieldset, .pnl_listarea fieldset, .pnl_formarea fieldset {
border-color: #D0D0D0 -moz-use-text-color -moz-use-text-color;
border-style: solid none none;
border-width: 1px medium medium;
margin: 20px 0;
}
.pnl_toolsarea fieldset legend , .pnl_listarea fieldset legend, .pnl_formarea fieldset {
font-weight: bold;
}
.box {
padding:4px;
margin: 0 0 20px 0;
}
.box_error { border: 4px solid #CC0000; }
.box_error h1 { color: #CC0000; }
.box_support { border: 1px solid #6495ed; }
.box_support h1 { color: #6495ed; }
.box_msg { border: 2px solid #6495ed; }
.box_msg h1 { color: #6495ed; }
.codeview {
margin:20px 0;
padding:2px;
border: 1px solid #ffcc00;
background: #fffaea;
font-family: Consolas, "Lucida Console", "Courier New", monospace;
font-size: 0.9em;
}
/* Lists */
table.list {
width: 100%;
border: 1px solid #d3d3d3 !important;
}
table.list thead th { font-size: 10px; }
table.list tbody { border: 1px solid #d3d3d3 !important; }
table.list tfoot td { text-align: center; background: #f8f8f8 url(../../images/lists_tfoot_bg.png) repeat-x bottom left; padding: 24px 8px 8px 8px; }
table.list .tbl_row_even { background: #fcfcfc; }
table.list .tbl_row_uneven { background: #f0f8ff; }
table.list tr:hover { background: #fffacd; }
/* Password Strength */
#passBar {
width: 101px; height: 10px;
background: url(../../images/meter_bg.gif) repeat-x bottom left;
margin: 2px 0;
float: left;
}
#passText {
padding: 0 8px;
float: left;
}
/* Systemmonitor */
.systemmonitor-state {
margin: 10px 0;
font-family: Consolas, "Lucida Console", "Courier New", monospace;
font-size: 0.9em;
}
.systemmonitor-state.state-no_state {
border-top: 4px solid #95A19F;
background-color: #FBF6EE;
}
.systemmonitor-state.state-unknown {
border-top: 4px solid #30302e;
background-color: #cecfc5;
}
.systemmonitor-state.state-ok {
border-top: 4px solid #23fb00;
background-color: #adffa2;
}
.systemmonitor-state.state-info {
border-top: 4px solid #fdff00;
background-color: #fdffa2;
}
.systemmonitor-state.state-warning {
border-top: 4px solid #ffa800;
background-color: #ffda93;
}
.systemmonitor-state.state-critical {
border-top: 4px solid #ff0000;
background-color: #ffb9b9;
}
.systemmonitor-state.state-error {
border-top: 4px solid #ff0000;
background-color: #ff7f7f;
}
.systemmonitor-device {
background-repeat: no-repeat;
background-position: 12px 4px;
min-height: 80px;
}
.systemmonitor-device.device-system { background-image: url("../../icons/x64/network.png"); }
.systemmonitor-device.device-server { background-image: url("../../icons/x64/server.png"); }
.systemmonitor-content.icons32 {
padding:2px 10px 2px 80px;
background-repeat: no-repeat;
background-position: 12px 4px;
}
.systemmonitor-content.icons32.ico-no_state { /*background-image:url("../../icons/x32/state_no.png"); */ }
.systemmonitor-content.icons32.ico-unknown { background-image:url("../../icons/x32/state_unknown.png"); }
.systemmonitor-content.icons32.ico-ok { background-image:url("../../icons/x32/state_ok.png"); }
.systemmonitor-content.icons32.ico-info { background-image:url("../../icons/x32/state_info.png"); }
.systemmonitor-content.icons32.ico-warning { background-image:url("../../icons/x32/state_warning.png"); }
.systemmonitor-content.icons32.ico-critical { background-image:url("../../icons/x32/state_critical.png"); }
.systemmonitor-content.icons32.ico-error { background-image:url("../../icons/x32/state_error.png"); }
.systemmonitor-content table {
border: none;
margin-top: 10px;
}
.systemmonitor-content * .online {
border: 1px solid #ffffff;
background-color: #E3FFB8;
color: #000000;
padding:0px 5px;
}
.systemmonitor-content * .offline {
border: 1px solid #ffffff;
background-color: #d12f19;
color:#ffffff;
padding:0px 5px;
}
/* Image-Replacement */
.swap { background-repeat:no-repeat; }
.swap span { display:none; height:16px; }
#ir-HeaderLogo { background-image:url("../../images/header_logo.png"); height:32px; }
#ir-Yes { background-image:url("../../icons/x16/tick_circle.png"); height:16px; }
#ir-No { background-image:url("../../icons/x16/cross_circle.png"); height:16px; }
/* BUTTONS */
.buttons a, .buttons button{
display:block;
float:left;
margin:0 7px 0 0;
background-color:#f5f5f5;
border:1px solid #dedede;
border-top:1px solid #eee;
border-left:1px solid #eee;
font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:90%;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
padding:5px 10px 6px 7px; /* Links */
}
.buttons button{
width:auto;
overflow:visible;
padding:4px 10px 3px 7px; /* IE6 */
}
.buttons button[type]{
padding:5px 10px 5px 7px; /* Firefox */
line-height:17px; /* Safari */
}
*:first-child+html button[type]{
padding:4px 10px 3px 7px; /* IE7 */
}
.buttons button img, .buttons a img{
margin:0 3px -3px 0 !important;
padding:0;
border:none;
width:16px;
height:16px;
}
/* BUTTONS STANDARD */
button:hover, .buttons a:hover{
background-color:#dff4ff;
border:1px solid #c2e1ef;
color:#336699;
}
.buttons a:active{
background-color:#6299c5;
border:1px solid #6299c5;
color:#fff;
}
/* BUTTONS POSITIVE */
button.positive, .buttons a.positive{
color:#529214;
}
.buttons a.positive:hover, button.positive:hover{
background-color:#E6EFC2;
border:1px solid #C6D880;
color:#529214;
}
.buttons a.positive:active{
background-color:#529214;
border:1px solid #529214;
color:#fff;
}
/* BUTTONS NEGATIVE */
.buttons a.negative, button.negative{
color:#d12f19;
}
.buttons a.negative:hover, button.negative:hover{
background-color:#fbe3e4;
border:1px solid #fbc2c4;
color:#d12f19;
}
.buttons a.negative:active{
background-color:#d12f19;
border:1px solid #d12f19;
color:#fff;
}
/* Button with icon and text */
.iconstxt {
background-repeat: no-repeat;
background-position: 4px 4px;
}
.iconstxt span { padding-left: 20px; }
.iconstxt.icoPositive { background-image: url("../../icons/x16/tick_circle_frame.png"); }
.iconstxt.icoNegative { background-image: url("../../icons/x16/cross_circle_frame.png"); }
.iconstxt.icoAdd { background-image: url(../../icons/x16/plus_circle_frame.png); }
.iconstxt.icoKey { background-image: url("../../icons/x16/key.png"); }
/* Button with icon and without text */
.icons16 span { display: none; }
a.icons16 { height: 18px; width: 18px; padding: 0; background-repeat: no-repeat; background-position: 1px 1px;}
button.icons16 { height: 20px; width: 20px; padding: 0; background-repeat: no-repeat; background-position: 1px 1px;}
.icons16.icoDelete { background-image: url("../../icons/x16/minus_circle_frame.png"); }
.icons16.icoFilter { background-image: url(../../icons/x16/funnel.png); }
.icons16.icoEdit { background-image: url("../../icons/x16/wrench.png"); }
.icons16.icoDbAdmin { background-image: url("../../icons/x16/database.png"); }
.icons16.icoLoginAs { background-image: url("../../icons/x16/user_go.png"); }
.icons16.icoWebmailer { background-image: url("../../icons/x16/mails_arrow.png"); }
}
@charset "UTF-8";
/**
* "Yet Another Multicolumn Layout" - (X)HTML/CSS Framework
*
* (en) Uniform design of ISPConfig elements - ISPConfig 3: default theme
* (de) Einheitliche Standardformatierungen f�r ISPConfig-Elemente - ISPConfig 3: default theme
*
* @copyright Copyright 2005-2008, Dirk Jesse
* @license CC-A 2.0 (http://creativecommons.org/licenses/by/2.0/),
* YAML-C (http://www.yaml.de/en/license/license-conditions.html)
* @link http://www.yaml.de
* @package yaml
* @version 3.0.6
* @revision $Revision: 202 $
* @lastmodified $Date: 2008-06-07 14:29:18 +0200 (Sa, 07 Jun 2008) $