From af8f1ba169081990bfbe62fe295d8124f6aadc5c Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 17 Oct 2007 14:16:35 -0400
Subject: [PATCH] Added support for shell users in the interface and fixed several strict syntax issues.
---
interface/web/sites/templates/shell_user_list.htm | 31 ++
interface/web/client/templates/client_edit_limits.htm | 4
interface/web/client/form/client.tform.php | 14 +
interface/web/sites/lib/module.conf.php | 20 +
interface/web/sites/shell_user_del.php | 54 ++++
server/plugins-enabled/apache2_plugin.inc.php | 16 +
interface/web/sites/templates/shell_user_advanced.htm | 28 ++
interface/web/admin/lib/lang/en_server_ip.lng | 2
interface/web/sites/ftp_user_edit.php | 2
interface/web/client/lib/lang/en_client.lng | 2
interface/web/sites/templates/shell_user_edit.htm | 44 +++
INSTALL_DEBIAN.txt | 8
install/lib/installer_base.lib.php | 2
interface/web/client/client_edit.php | 2
interface/web/sites/shell_user_list.php | 58 ++++
interface/web/sites/list/shell_user.list.php | 99 ++++++++
interface/web/sites/shell_user_edit.php | 103 ++++++++
interface/web/sites/form/shell_user.tform.php | 191 +++++++++++++++
interface/web/sites/lib/lang/en_shell_user.lng | 14 +
interface/web/sites/lib/lang/en_shell_user_list.lng | 14 +
20 files changed, 700 insertions(+), 8 deletions(-)
diff --git a/INSTALL_DEBIAN.txt b/INSTALL_DEBIAN.txt
index 7ab2798..243566b 100644
--- a/INSTALL_DEBIAN.txt
+++ b/INSTALL_DEBIAN.txt
@@ -34,6 +34,14 @@
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool
+Edit the file /etc/default/pure-ftpd-common
+
+vi /etc/default/pure-ftpd-common
+
+and change the start mode from inetd to standalone. Then execute:
+
+/etc/init.d/openbsd-inetd restart
+
5) Install mydns
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index b5f0617..65a150f 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -522,7 +522,7 @@
exec("chmod 600 $config_dir/$configfile");
exec("chown root:root $config_dir/$configfile");
// **enable chrooting
- exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone');
+ //exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone');
exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone');
}
diff --git a/interface/web/admin/lib/lang/en_server_ip.lng b/interface/web/admin/lib/lang/en_server_ip.lng
index c14566e..a0d88dc 100644
--- a/interface/web/admin/lib/lang/en_server_ip.lng
+++ b/interface/web/admin/lib/lang/en_server_ip.lng
@@ -1,7 +1,7 @@
<?php
$wb["server_id_txt"] = 'Server';
$wb["ip_address_txt"] = 'IP Address';
-$wb["virtualhost_txt"] = 'Virtualhost';
+$wb["virtualhost_txt"] = 'HTTP NameVirtualHost';
$wb["ip_err"] = 'IP address invalid';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 473de4b..d2068d8 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -98,7 +98,7 @@
}
// password changed
- if($this->dataRecord["password"] != '') {
+ if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
$password = addslashes($this->dataRecord["password"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index d87e2f9..14aeab1 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -526,6 +526,20 @@
'rows' => '',
'cols' => ''
),
+ 'limit_shell_user' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'ISINT',
+ 'errmsg'=> 'limit_shell_user_error_notint'),
+ ),
+ 'default' => '-1',
+ 'value' => '',
+ 'separator' => '',
+ 'width' => '10',
+ 'maxlength' => '10',
+ 'rows' => '',
+ 'cols' => ''
+ ),
'default_dnsserver' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng
index 435a290..fbc1fbf 100644
--- a/interface/web/client/lib/lang/en_client.lng
+++ b/interface/web/client/lib/lang/en_client.lng
@@ -53,6 +53,6 @@
$wb["default_dnsserver_txt"] = 'Default DNS Server';
$wb["limit_dns_zone_txt"] = 'Max. number of DNS zones';
$wb["limit_dns_record_txt"] = 'Max. number DNS records';
-
+$wb["limit_shell_user_txt"] = 'Max. number of Shell users';
?>
\ No newline at end of file
diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm
index e33d0b3..f130d89 100644
--- a/interface/web/client/templates/client_edit_limits.htm
+++ b/interface/web/client/templates/client_edit_limits.htm
@@ -91,6 +91,10 @@
<td class="frmText11" width="220"><input name="limit_ftp_user" type="text" class="text" value="{tmpl_var name='limit_ftp_user'}" size="10" maxlength="10"></td>
</tr>
<tr>
+ <td class="frmText11" width="280">{tmpl_var name='limit_shell_user_txt'}:</td>
+ <td class="frmText11" width="220"><input name="limit_shell_user" type="text" class="text" value="{tmpl_var name='limit_shell_user'}" size="10" maxlength="10"></td>
+ </tr>
+ <tr>
<td><h2>DNS</h2></td>
</tr>
<tr>
diff --git a/interface/web/sites/form/shell_user.tform.php b/interface/web/sites/form/shell_user.tform.php
new file mode 100644
index 0000000..7ddc281
--- /dev/null
+++ b/interface/web/sites/form/shell_user.tform.php
@@ -0,0 +1,191 @@
+<?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"] = "Shell User";
+$form["description"] = "";
+$form["name"] = "shell_user";
+$form["action"] = "shell_user_edit.php";
+$form["db_table"] = "shell_user";
+$form["db_table_idx"] = "shell_user_id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "shell";
+$form["list_default"] = "shell_user_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"]['shell'] = array (
+ 'title' => "Shell User",
+ 'width' => 100,
+ 'template' => "templates/shell_user_edit.htm",
+ 'fields' => array (
+ ##################################
+ # Begin Datatable fields
+ ##################################
+ 'server_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'value' => ''
+ ),
+ 'parent_domain_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+ 'keyfield'=> 'domain_id',
+ 'valuefield'=> 'domain'
+ ),
+ 'value' => ''
+ ),
+ 'username' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'username_error_empty'),
+ 1 => array ( 'type' => 'UNIQUE',
+ 'errmsg'=> 'username_error_unique'),
+ 2 => array ( 'type' => 'REGEX',
+ 'regex' => '/^[\w\.\-]{1,64}$/',
+ 'errmsg'=> 'username_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'password' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'PASSWORD',
+ 'encryption' => 'CRYPT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'quota_size' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'quota_size_error_empty'),
+ ),
+ 'default' => '-1',
+ 'value' => '',
+ 'width' => '7',
+ 'maxlength' => '7'
+ ),
+ 'active' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+if($_SESSION["s"]["user"]["typ"] == 'admin') {
+
+$form["tabs"]['advanced'] = array (
+ 'title' => "Options",
+ 'width' => 100,
+ 'template' => "templates/shell_user_advanced.htm",
+ 'fields' => array (
+ ##################################
+ # Begin Datatable fields
+ ##################################
+ 'uid' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'uid_error_empty'),
+ ),
+ 'default' => '0',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'gid' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'uid_error_empty'),
+ ),
+ 'default' => '0',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'shell' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '/bin/bash',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'dir' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'directory_error_empty'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index 2c704b6..61f549c 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -63,7 +63,7 @@
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT limit_ftp_user FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
- // Check if the user may add another maildomain.
+ // Check if the user may add another ftp user.
if($client["limit_ftp_user"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT count(ftp_user_id) as number FROM ftp_user WHERE sys_groupid = $client_group_id");
if($tmp["number"] >= $client["limit_ftp_user"]) {
diff --git a/interface/web/sites/lib/lang/en_shell_user.lng b/interface/web/sites/lib/lang/en_shell_user.lng
new file mode 100644
index 0000000..88004b6
--- /dev/null
+++ b/interface/web/sites/lib/lang/en_shell_user.lng
@@ -0,0 +1,14 @@
+<?php
+$wb["uid_txt"] = 'Web Username';
+$wb["gid_txt"] = 'Group';
+$wb["shell_txt"] = 'Shell';
+$wb["dir_txt"] = 'Dir';
+$wb["btn_save_txt"] = 'Save';
+$wb["btn_cancel_txt"] = 'Cancel';
+$wb["server_id_txt"] = 'Server';
+$wb["parent_domain_id_txt"] = 'Site';
+$wb["username_txt"] = 'Username';
+$wb["password_txt"] = 'Password';
+$wb["quota_size_txt"] = 'Quota';
+$wb["active_txt"] = 'Active';
+?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/en_shell_user_list.lng b/interface/web/sites/lib/lang/en_shell_user_list.lng
new file mode 100644
index 0000000..45f60ff
--- /dev/null
+++ b/interface/web/sites/lib/lang/en_shell_user_list.lng
@@ -0,0 +1,14 @@
+<?php
+$wb["list_head_txt"] = 'Shell User';
+$wb["active_txt"] = 'Active';
+$wb["server_id_txt"] = 'Server';
+$wb["parent_domain_id_txt"] = 'Site';
+$wb["username_txt"] = 'Username';
+$wb["page_txt"] = 'Page';
+$wb["page_of_txt"] = 'of';
+$wb["page_next_txt"] = 'Next';
+$wb["page_back_txt"] = 'Back';
+$wb["delete_txt"] = 'Delete';
+$wb["filter_txt"] = 'Filter';
+$wb["add_new_record_txt"] = 'Add new Shell-User';
+?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php
index 8be6e6e..c863e60 100644
--- a/interface/web/sites/lib/module.conf.php
+++ b/interface/web/sites/lib/module.conf.php
@@ -28,7 +28,7 @@
'open' => 1,
'items' => $items);
-// aufr�umen
+// clean up
unset($items);
/*
@@ -44,7 +44,23 @@
'open' => 1,
'items' => $items);
-// aufr�umen
+// clean up
+unset($items);
+
+/*
+ FTP User menu
+*/
+
+$items[] = array( 'title' => "Shell-User",
+ 'target' => 'content',
+ 'link' => 'sites/shell_user_list.php');
+
+
+$module["nav"][] = array( 'title' => 'Shell',
+ 'open' => 1,
+ 'items' => $items);
+
+// clean up
unset($items);
diff --git a/interface/web/sites/list/shell_user.list.php b/interface/web/sites/list/shell_user.list.php
new file mode 100644
index 0000000..6e22077
--- /dev/null
+++ b/interface/web/sites/list/shell_user.list.php
@@ -0,0 +1,99 @@
+<?php
+
+/*
+ Datatypes:
+ - INTEGER
+ - DOUBLE
+ - CURRENCY
+ - VARCHAR
+ - TEXT
+ - DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] = "shell_user";
+
+// Database table
+$liste["table"] = "shell_user";
+
+// Index index field of the database table
+$liste["table_idx"] = "shell_user_id";
+
+// Search Field Prefix
+$liste["search_prefix"] = "search_";
+
+// Records per page
+$liste["records_per_page"] = 15;
+
+// Script File of the list
+$liste["file"] = "shell_user_list.php";
+
+// Script file of the edit form
+$liste["edit_file"] = "shell_user_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"] = "shell_user_del.php";
+
+// Paging Template
+$liste["paging_tpl"] = "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"] = "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+
+$liste["item"][] = array( 'field' => "active",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "",
+ 'value' => array('y' => "Yes",'n' => "No"));
+
+
+$liste["item"][] = array( 'field' => "server_id",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'width' => "",
+ 'value' => "");
+
+$liste["item"][] = array( 'field' => "parent_domain_id",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+ 'keyfield'=> 'domain_id',
+ 'valuefield'=> 'domain'
+ ),
+ 'width' => "",
+ 'value' => "");
+
+$liste["item"][] = array( 'field' => "username",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/shell_user_del.php b/interface/web/sites/shell_user_del.php
new file mode 100644
index 0000000..c834408
--- /dev/null
+++ b/interface/web/sites/shell_user_del.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2007, 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
+******************************************/
+
+$list_def_file = "list/shell_user.list.php";
+$tform_def_file = "form/shell_user.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checke Berechtigungen f�r Modul
+if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
+ header("Location: ../index.php");
+ exit;
+}
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
new file mode 100644
index 0000000..be7ded6
--- /dev/null
+++ b/interface/web/sites/shell_user_edit.php
@@ -0,0 +1,103 @@
+<?php
+/*
+Copyright (c) 2007, 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/shell_user.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
+ header("Location: ../index.php");
+ exit;
+}
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_ftp_user FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ // Check if the user may add another shell user.
+ if($client["limit_shell_user"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(shell_user_id) as number FROM shell_user WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_shell_user"]) {
+ $app->error($app->tform->wordbook["limit_shell_user_txt"]);
+ }
+ }
+ }
+
+ parent::onShowNew();
+ }
+
+ function onAfterInsert() {
+ global $app, $conf;
+
+ $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+ $server_id = $web["server_id"];
+ $dir = $web["document_root"];
+ $uid = $web["system_user"];
+ $gid = $web["system_group"];
+
+ $sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid' WHERE shell_user_id = ".$this->id;
+ $app->db->query($sql);
+
+ }
+
+ function onAfterUpdate() {
+ global $app, $conf;
+
+
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/shell_user_list.php b/interface/web/sites/shell_user_list.php
new file mode 100644
index 0000000..3909b84
--- /dev/null
+++ b/interface/web/sites/shell_user_list.php
@@ -0,0 +1,58 @@
+<?php
+
+/*
+Copyright (c) 2007, 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.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/shell_user.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
+ header("Location: ../index.php");
+ exit;
+}
+
+$app->uses('listform_actions');
+
+// Limit the results to alias domains
+//$app->listform_actions->SQLExtWhere = "type = 'subdomain'";
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/templates/shell_user_advanced.htm b/interface/web/sites/templates/shell_user_advanced.htm
new file mode 100644
index 0000000..3ae6d4f
--- /dev/null
+++ b/interface/web/sites/templates/shell_user_advanced.htm
@@ -0,0 +1,28 @@
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="frmText11">{tmpl_var name='uid_txt'}:</td>
+ <td class="frmText11"><input name="uid" type="text" class="text" value="{tmpl_var name='uid'}" size="30" maxlength="255"></td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='gid_txt'}:</td>
+ <td class="frmText11"><input name="gid" type="text" class="text" value="{tmpl_var name='gid'}" size="30" maxlength="255"></td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='shell_txt'}:</td>
+ <td class="frmText11"><input name="shell" type="text" class="text" value="{tmpl_var name='shell'}" size="30" maxlength="255"></td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='dir_txt'}:</td>
+ <td class="frmText11"><input name="dir" type="text" class="text" value="{tmpl_var name='dir'}" size="30" maxlength="255"></td>
+ </tr> <tr>
+ <td class="frmText11"> </td>
+ <td class="frmText11"> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/shell_user_edit.php');"><div class="buttonEnding"></div>
+ <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/shell_user_list.php');"><div class="buttonEnding"></div>
+ </td>
+ </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
diff --git a/interface/web/sites/templates/shell_user_edit.htm b/interface/web/sites/templates/shell_user_edit.htm
new file mode 100644
index 0000000..16d2d97
--- /dev/null
+++ b/interface/web/sites/templates/shell_user_edit.htm
@@ -0,0 +1,44 @@
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="frmText11">{tmpl_var name='server_id_txt'}:</td>
+ <td class="frmText11">
+ <select name="server_id" class="text">
+ {tmpl_var name='server_id'}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='parent_domain_id_txt'}:</td>
+ <td class="frmText11">
+ <select name="parent_domain_id" class="text">
+ {tmpl_var name='parent_domain_id'}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='username_txt'}:</td>
+ <td class="frmText11"><input name="username" type="text" class="text" value="{tmpl_var name='username'}" size="30" maxlength="255"></td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='password_txt'}:</td>
+ <td class="frmText11"><input name="password" type="password" class="text" value="{tmpl_var name='password'}" size="30" maxlength="255"></td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='quota_size_txt'}:</td>
+ <td class="frmText11"><input name="quota_size" type="text" class="text" value="{tmpl_var name='quota_size'}" size="7" maxlength="7"></td>
+ </tr>
+ <tr>
+ <td class="frmText11">{tmpl_var name='active_txt'}:</td>
+ <td class="frmText11">{tmpl_var name='active'}</td>
+ </tr> <tr>
+ <td class="frmText11"> </td>
+ <td class="frmText11"> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/shell_user_edit.php');"><div class="buttonEnding"></div>
+ <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/shell_user_list.php');"><div class="buttonEnding"></div>
+ </td>
+ </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
diff --git a/interface/web/sites/templates/shell_user_list.htm b/interface/web/sites/templates/shell_user_list.htm
new file mode 100644
index 0000000..69a8b9f
--- /dev/null
+++ b/interface/web/sites/templates/shell_user_list.htm
@@ -0,0 +1,31 @@
+<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
+<input type="button" value="{tmpl_var name="add_new_record_txt"}" class="button" onClick="loadContent('sites/shell_user_edit.php');" /><div class="buttonEnding"></div><br /><br />
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="listTable">
+ <tr>
+ <td class="tblHead"><tmpl_var name="active_txt"></td>
+ <td class="tblHead"><tmpl_var name="server_id_txt"></td>
+ <td class="tblHead"><tmpl_var name="parent_domain_id_txt"></td>
+ <td class="tblHead"><tmpl_var name="username_txt"></td>
+ <td class="tblHead"> </td>
+ </tr>
+ <tr>
+ <td class="frmText11"><select name="search_active" onChange="submitForm('pageForm','sites/shell_user_list.php');">{tmpl_var name='search_active'}</select></td>
+ <td class="frmText11"><select name="search_server_id" onChange="submitForm('pageForm','sites/shell_user_list.php');">{tmpl_var name='search_server_id'}</select></td>
+ <td class="frmText11"><select name="search_parent_domain_id" onChange="submitForm('pageForm','sites/shell_user_list.php');">{tmpl_var name='search_parent_domain_id'}</select></td>
+ <td class="frmText11"><input type="text" name="search_username" value="{tmpl_var name='search_username'}" class="text" /></td>
+ <td class="frmText11" align="right"><input name="Filter" type="button" id="Filter" value="{tmpl_var name="filter_txt"}" class="button" onClick="submitForm('pageForm','sites/shell_user_list.php');"><div class="buttonEnding"></div></td>
+ </tr>
+ <tmpl_loop name="records">
+ <tr bgcolor="{tmpl_var name="bgcolor"}">
+ <td class="frmText11"><a href="#" onClick="loadContent('sites/shell_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="active"}</a></td>
+ <td class="frmText11"><a href="#" onClick="loadContent('sites/shell_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="server_id"}</a></td>
+ <td class="frmText11"><a href="#" onClick="loadContent('sites/shell_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="parent_domain_id"}</a></td>
+ <td class="frmText11"><a href="#" onClick="loadContent('sites/shell_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="username"}</a></td>
+ <td class="frmText11" align="right">[<a href="javascript: del_record('sites/shell_user_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
+ </tr>
+ </tmpl_loop>
+
+ <tr>
+ <td colspan="5" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
+ </tr>
+</table>
\ No newline at end of file
diff --git a/server/plugins-enabled/apache2_plugin.inc.php b/server/plugins-enabled/apache2_plugin.inc.php
index a068fe5..dc8dc38 100644
--- a/server/plugins-enabled/apache2_plugin.inc.php
+++ b/server/plugins-enabled/apache2_plugin.inc.php
@@ -49,6 +49,10 @@
$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
+ $app->plugins->registerEvent('server_ip_insert',$this->plugin_name,'server_ip');
+ $app->plugins->registerEvent('server_ip_update',$this->plugin_name,'server_ip');
+ $app->plugins->registerEvent('server_ip_delete',$this->plugin_name,'server_ip');
+
}
function insert($event_name,$data) {
@@ -104,7 +108,7 @@
// Copy the error pages
$error_page_path = escapeshellcmd($data["new"]["web_document_root"])."/web/error/";
- exec("copy /usr/local/ispconfig/server/conf/error/".escapeshellcmd($conf["language"])."/* ".$error_page_path);
+ exec("cp /usr/local/ispconfig/server/conf/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path);
// Create group and user, if not exist
$app->uses("system");
@@ -225,6 +229,16 @@
}
+ //* This function is called when a IP on the server is inserted, updated or deleted
+ function server_ip($event_name,$data) {
+ global $app, $conf;
+
+ // Here we write the name virtualhost directives
+ // NameVirtualHost IP:80
+ // NameVirtualHost IP:443
+
+ }
+
} // end class
--
Gitblit v1.9.1