- Global settings are configurable trough a form under admin > system > Interface Config
- Formatted error messages for better visibility.
4 files added
2 files modified
New file |
| | |
| | | <?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 |
| | | ################################## |
| | | ) |
| | | ); |
| | | |
| | | |
| | | |
| | | ?> |
New 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.'; |
| | | |
| | | ?> |
| | |
| | | '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 |
New file |
| | |
| | | <?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(); |
| | | |
| | | |
| | | ?> |
New 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> |
| | |
| | | font-weight: bold;
|
| | | }
|
| | |
|
| | | .error { |
| | | color: #FF0000; |
| | | margin-bottom: 10px; |
| | | border-width: 1px; |
| | | border-style: solid; |
| | | border-color: #FF0000; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .box {
|
| | | padding:4px;
|
| | | margin: 0 0 20px 0;
|