Skip to content
Snippets Groups Projects
Commit 33ff5ab0 authored by Dominik's avatar Dominik
Browse files

check aliasdomains correctly

removed unnecessary bak-files
parent c0726b9d
No related branches found
No related tags found
4 merge requests!88Fix Update errors,!46Master,!32VHost-Aliasdomain (FS#3296),!30Vhostalias
Showing with 2 additions and 3148 deletions
<?php
/*
Copyright (c) 2012, ISPConfig UG
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';
//* Check permissions for module
$app->auth->check_module_permissions('dashboard');
$app->uses('tform');
$type = $_GET["type"];
//if($_SESSION["s"]["user"]["typ"] == 'admin') {
if($type == 'globalsearch'){
$q = $app->db->quote(trim($_GET["q"]));
$authsql = " AND ".$app->tform->getAuthSQL('r');
$modules = explode(',', $_SESSION['s']['user']['modules']);
$result = array();
// clients
$result[] = _search('client', 'client', "AND limit_client = 0");
// resellers
$result[] = _search('client', 'reseller', "AND limit_client != 0");
// web sites
$result[] = _search('sites', 'web_domain', "AND type = 'vhost'");
// subdomains
$result[] = _search('sites', 'web_subdomain', "AND type = 'subdomain'");
// web site aliases
$result[] = _search('sites', 'web_aliasdomain', "AND type = 'alias'");
// vhostsubdomains
$result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'");
// FTP users
$result[] = _search('sites', 'ftp_user');
// shell users
$result[] = _search('sites', 'shell_user');
// databases
/*
$result_databases = array('cheader' => array(), 'cdata' => array());
if(in_array('sites', $modules)){
$sql = "SELECT * FROM web_database WHERE database_name LIKE '%".$q."%' OR database_user LIKE '%".$q."%' OR remote_ips LIKE '%".$q."%'".$authsql." ORDER BY database_name";
$results = $app->db->queryAllRecords($sql);
if(is_array($results) && !empty($results)){
$result_databases['cheader'] = array('title' => 'Databases',
'total' => count($results),
'limit' => count($results)
);
foreach($results as $result){
$description = 'Database User: '.$result['database_user'].' - Remote IPs: '.$result['remote_ips'];
$result_databases['cdata'][] = array('title' => $result['database_name'],
'description' => $description,
'onclick' => 'capp(\'sites\',\'sites/database_edit.php?id='.$result['database_id'].'\');',
'fill_text' => strtolower($result['database_name'])
);
}
}
}
*/
$result[] = _search('sites', 'database');
// database users
$result[] = _search('sites', 'database_user');
// email domains
$result[] = _search('mail', 'mail_domain');
// email alias domains
$result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'");
// email mailboxes
$result[] = _search('mail', 'mail_user');
// email aliases
$result[] = _search('mail', 'mail_alias', "AND type = 'alias'");
// email forwards
$result[] = _search('mail', 'mail_forward', "AND type = 'forward'");
// email catchalls
$result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'");
// email transports
$result[] = _search('mail', 'mail_transport');
// mailinglists
$result[] = _search('mail', 'mail_mailinglist');
// getmails
$result[] = _search('mail', 'mail_get');
// dns zones
$result[] = _search('dns', 'dns_soa');
// secondary dns zones
$result[] = _search('dns', 'dns_slave');
// virtual machines
$result[] = _search('vm', 'openvz_vm');
// virtual machines os templates
$result[] = _search('vm', 'openvz_ostemplate');
// virtual machines vm templates
$result[] = _search('vm', 'openvz_template');
// virtual machines ip addresses
$result[] = _search('vm', 'openvz_ip');
// directive snippets
$result[] = _search('admin', 'directive_snippets');
$json = $app->functions->json_encode($result);
}
//}
function _search($module, $section, $additional_sql = ''){
global $app, $q, $authsql, $modules;
$result_array = array('cheader' => array(), 'cdata' => array());
if(in_array($module, $modules)){
$search_fields = array();
$desc_fields = array();
if(is_file('../'.$module.'/form/'.$section.'.tform.php')){
include_once '../'.$module.'/form/'.$section.'.tform.php';
$category_title = $form["title"];
$form_file = $form["action"];
$db_table = $form["db_table"];
$db_table_idx = $form["db_table_idx"];
$order_by = $db_table_idx;
if(is_array($form["tabs"]) && !empty($form["tabs"])){
foreach($form["tabs"] as $tab){
if(is_array($tab['fields']) && !empty($tab['fields'])){
foreach($tab['fields'] as $key => $val){
if(isset($val['searchable']) && $val['searchable'] > 0){
$search_fields[] = $key." LIKE '%".$q."%'";
if($val['searchable'] == 1){
$order_by = $key;
$title_key = $key;
}
if($val['searchable'] == 2){
$desc_fields[] = $key;
}
}
}
}
}
}
}
unset($form);
$where_clause = '';
if(!empty($search_fields)){
$where_clause = implode(' OR ', $search_fields);
} else {
// valid SQL query which returns an empty result set
$where_clause = '1 = 0';
}
if($where_clause != '') $where_clause = '('.$where_clause.')';
if($additional_sql != '') $where_clause .= ' '.$additional_sql.' ';
$order_clause = '';
if($order_by != '') $order_clause = ' ORDER BY '.$order_by;
$sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10";
$results = $app->db->queryAllRecords($sql);
if(is_array($results) && !empty($results)){
$lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng';
if(is_file($lng_file)) include $lng_file;
$result_array['cheader'] = array('title' => $category_title,
'total' => count($results),
'limit' => count($results)
);
foreach($results as $result){
$description = '';
if(!empty($desc_fields)){
$desc_items = array();
foreach($desc_fields as $desc_field){
if($result[$desc_field] != '') $desc_items[] = $wb[$desc_field.'_txt'].': '.$result[$desc_field];
}
if(!empty($desc_items)) $description = implode(' - ', $desc_items);
}
$result_array['cdata'][] = array('title' => $wb[$title_key.'_txt'].': '.$result[$title_key],
'description' => $description,
'onclick' => "capp('".$module."','".$module."/".$form_file."?id=".$result[$db_table_idx]."');",
'fill_text' => strtolower($result[$title_key])
);
}
}
}
return $result_array;
}
header('Content-type: application/json');
echo $json;
?>
<?php
class dashlet_limits {
function show() {
global $app, $conf;
$limits = array();
/* Limits to be shown*/
$limits[] = array('field' => 'limit_maildomain',
'db_table' => 'mail_domain',
'db_where' => '');
$limits[] = array('field' => 'limit_mailmailinglist',
'db_table' => 'mail_mailinglist',
'db_where' => '');
$limits[] = array('field' => 'limit_mailbox',
'db_table' => 'mail_user',
'db_where' => '');
$limits[] = array('field' => 'limit_mailalias',
'db_table' => 'mail_forwarding',
'db_where' => "type = 'alias'");
$limits[] = array('field' => 'limit_mailaliasdomain',
'db_table' => 'mail_forwarding',
'db_where' => "type = 'aliasdomain'");
$limits[] = array('field' => 'limit_mailforward',
'db_table' => 'mail_forwarding',
'db_where' => "type = 'forward'");
$limits[] = array('field' => 'limit_mailcatchall',
'db_table' => 'mail_forwarding',
'db_where' => "type = 'catchall'");
$limits[] = array('field' => 'limit_mailrouting',
'db_table' => 'mail_transport',
'db_where' => "");
$limits[] = array('field' => 'limit_mailfilter',
'db_table' => 'mail_user_filter',
'db_where' => "");
$limits[] = array('field' => 'limit_fetchmail',
'db_table' => 'mail_get',
'db_where' => "");
$limits[] = array('field' => 'limit_spamfilter_wblist',
'db_table' => 'spamfilter_wblist',
'db_where' => "");
$limits[] = array('field' => 'limit_spamfilter_user',
'db_table' => 'spamfilter_users',
'db_where' => "");
$limits[] = array('field' => 'limit_spamfilter_policy',
'db_table' => 'spamfilter_policy',
'db_where' => "");
$limits[] = array('field' => 'limit_web_domain',
'db_table' => 'web_domain',
'db_where' => "type = 'vhost'");
$limits[] = array('field' => 'limit_web_subdomain',
'db_table' => 'web_domain',
'db_where' => "(type = 'subdomain' OR type = 'vhostsubdomain')");
$limits[] = array('field' => 'limit_web_aliasdomain',
'db_table' => 'web_domain',
'db_where' => "type = 'alias'");
$limits[] = array('field' => 'limit_ftp_user',
'db_table' => 'ftp_user',
'db_where' => "");
$limits[] = array('field' => 'limit_shell_user',
'db_table' => 'shell_user',
'db_where' => "");
$limits[] = array('field' => 'limit_dns_zone',
'db_table' => 'dns_soa',
'db_where' => "");
$limits[] = array('field' => 'limit_dns_slave_zone',
'db_table' => 'dns_slave',
'db_where' => "");
$limits[] = array('field' => 'limit_dns_record',
'db_table' => 'dns_rr',
'db_where' => "");
$limits[] = array('field' => 'limit_database',
'db_table' => 'web_database',
'db_where' => "");
$limits[] = array('field' => 'limit_cron',
'db_table' => 'cron',
'db_where' => "");
$limits[] = array('field' => 'limit_client',
'db_table' => 'client',
'db_where' => "");
//* Loading Template
$app->uses('tpl,tform');
$tpl = new tpl;
$tpl->newTemplate("dashlets/templates/limits.htm");
$wb = array();
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_limits.lng';
if(is_file($lng_file)) include $lng_file;
$tpl->setVar($wb);
if($app->auth->is_admin()) {
$user_is_admin = true;
} else {
$user_is_admin = false;
}
$tpl->setVar('is_admin', $user_is_admin);
if($user_is_admin == false) {
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
}
$rows = array();
foreach($limits as $limit) {
$field = $limit['field'];
if($user_is_admin) {
$value = $wb['unlimited_txt'];
} else {
$value = $client[$field];
}
if($value != 0 || $value == $wb['unlimited_txt']) {
$value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value;
$rows[] = array('field' => $field,
'field_txt' => $wb[$field.'_txt'],
'value' => $value_formatted,
'usage' => $this->_get_limit_usage($limit));
}
}
$tpl->setLoop('rows', $rows);
return $tpl->grab();
}
function _get_limit_usage($limit) {
global $app;
$sql = "SELECT count(sys_userid) as number FROM ".$app->db->quote($limit['db_table'])." WHERE ";
if($limit['db_where'] != '') $sql .= $limit['db_where']." AND ";
$sql .= $app->tform->getAuthSQL('r');
$rec = $app->db->queryOneRecord($sql);
return $rec['number'];
}
}
?>
<?php
/*
Copyright (c) 2012, ISPConfig UG
Contributors: web wack creations, http://www.web-wack.at
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';
//require_once('classes/class.guicontroller.php');
$app->load('aps_guicontroller');
// Check the module permissions
$app->auth->check_module_permissions('sites');
// Load needed classes
$app->uses('tpl,tform');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl', 'templates/aps_install_package.htm');
// Load the language file
$lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng';
require_once $lngfile;
$app->tpl->setVar($wb);
$app->load_language_file('web/sites/'.$lngfile);
// we will check only users, not admins
if($_SESSION["s"]["user"]["typ"] == 'user') {
$app->tform->formDef['db_table_idx'] = 'client_id';
$app->tform->formDef['db_table'] = 'client';
if(!$app->tform->checkClientLimit('limit_aps')) {
$app->error($app->lng("limit_aps_txt"));
}
if(!$app->tform->checkResellerLimit('limit_aps')) {
$app->error('Reseller: '.$wb["limit_aps_txt"]);
}
}
$adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
$gui = new ApsGUIController($app);
$pkg_id = (isset($_GET['id'])) ? $app->db->quote($_GET['id']) : '';
// Check if a newer version is available for the current package
// Note: It's intended that here is no strict ID check (see below)
if(isset($pkg_id))
{
$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
}
// Make sure an integer ID is given
if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag))
$app->error($app->lng('Invalid ID'));
// Get package details
$details = $gui->getPackageDetails($pkg_id);
if(isset($details['error'])) $app->error($details['error']);
$settings = $gui->getPackageSettings($pkg_id);
if(isset($settings['error'])) $app->error($settings['error']);
// Get domain list
$domains = array();
$domain_for_user = '';
if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."'
OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )";
$domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;");
if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain'];
// If data has been submitted, validate it
$result['input'] = array();
if(count($_POST) > 1)
{
$result = $gui->validateInstallerInput($_POST, $details, $domains, $settings);
if(empty($result['error']))
{
$gui->createPackageInstance($result['input'], $pkg_id);
@header('Location:aps_installedpackages_list.php');
}
else
{
$app->tpl->setVar('error', implode('<br />', $result['error']));
// Set memorized values (license, db password, install location)
if(!empty($result['input']))
foreach($result['input'] as $key => $value) $app->tpl->setVar('inp_'.$key, $value);
}
}
else $app->tpl->setVar('inp_main_database_password', ucfirst(substr(md5(crypt(rand(0, 10))), 0, 16)));
// Pass the package details to the template
foreach($details as $key => $value)
{
if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
else if($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
}
// Parse the template as far as possible, then do the rest manually
$app->tpl_defaults();
$parsed_tpl = $app->tpl->grab();
// ISPConfig has a very old and functionally limited template engine. We have to style parts on our own...
// Print the domain list
$domains_tpl = '';
if(!empty($domains))
{
$set = array();
$set[] = '<select name="main_domain" id="main_domain" class="selectInput">';
foreach($domains as $domain)
{
$selected = '';
if((count($_POST) > 1)
&& (isset($result['input']['main_domain']))
&& ($result['input']['main_domain'] == $domain))
$selected = ' selected ';
$set[] = '<option value="'.$domain.'" '.$selected.'>'.$domain.'</option>';
}
$set[] = '</select>';
$domains_tpl = implode("\n", $set);
}
$parsed_tpl = str_replace('DOMAIN_LIST_SPACE', $domains_tpl, $parsed_tpl);
// Print the packgae settings
$settings_tpl = '';
if(!empty($settings))
{
$set = array();
$set[] = '<legend>'.$app->lng('package_settings_txt').'</legend>';
foreach($settings as $setting)
{
$set[] = '<div class="ctrlHolder">';
$set[] = '<label for="'.$setting['SettingID'].'">'.$setting['SettingName'].'</label>';
if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password')
{
$input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password';
$input_value = '';
if((count($_POST) > 1)
&& (isset($result['input'][$setting['SettingID']])))
$input_value = $result['input'][$setting['SettingID']];
else $input_value = @$setting['SettingDefaultValue'];
$set[] = '<input type="'.$input_type.'" class="textInput" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" />
<p class="formHint">'.$setting['SettingDescription'].'</p>';
}
else if($setting['SettingInputType'] == 'checkbox')
{
$checked = '';
if((count($_POST) > 1)
&& (isset($result['input'][$setting['SettingID']])
&& ($result['input'][$setting['SettingID']] == 'true')))
$checked = 'checked ';
else if($setting['SettingDefaultValue'] == '1') $checked = 'checked ';
$set[] = '<input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/>
<p class="formHint">'.$setting['SettingDescription'].'</p>';
}
else if($setting['SettingInputType'] == 'select')
{
$set[] = '<select size="1" class="selectInput" name="'.$setting['SettingID'].'">';
foreach($setting['SettingChoices'] as $choice)
{
$selected = '';
if((count($_POST) > 1)
&& (isset($result['input'][$setting['SettingID']])))
{
if($result['input'][$setting['SettingID']] == $choice['EnumID'])
$selected = 'selected ';
}
else if($setting['SettingDefaultValue'] == $choice['EnumID']) $selected = 'selected ';
$set[] = '<option value="'.$choice['EnumID'].'" '.$selected.'>'.$choice['EnumName'].'</option>';
}
$set[] = '</select>
<p class="formHint">'.$setting['SettingDescription'].'</p>';
}
$set[] = '</div>';
}
$settings_tpl = implode("\n", $set);
}
$parsed_tpl = str_replace('PKG_SETTINGS_SPACE', $settings_tpl, $parsed_tpl);
echo $parsed_tpl;
?>
<?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"] = "Web Folder";
$form["description"] = "";
$form["name"] = "web_folder";
$form["action"] = "web_folder_edit.php";
$form["db_table"] = "web_folder";
$form["db_table_idx"] = "web_folder_id";
$form["db_history"] = "yes";
$form["tab_default"] = "folder";
$form["list_default"] = "web_folder_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"]['folder'] = array (
'title' => "Folder",
'width' => 100,
'template' => "templates/web_folder_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 mirror_server_id = 0 AND {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 web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
'keyfield'=> 'domain_id',
'valuefield'=> 'parent_domain'
),
'value' => ''
),
'path' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^[\w\.\-\_\/]{0,255}$/',
'errmsg'=> 'path_error_regex'),
),
'default' => '/',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'active' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
//#################################
// ENDE Datatable fields
//#################################
)
);
?>
<?php
/*
Datatypes:
- INTEGER
- DOUBLE
- CURRENCY
- VARCHAR
- TEXT
- DATE
*/
// Name of the list
$liste["name"] = "web_folder";
// Database table
$liste["table"] = "web_folder";
// Index index field of the database table
$liste["table_idx"] = "web_folder_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
// Records per page
$liste["records_per_page"] = "15";
// Script File of the list
$liste["file"] = "web_folder_list.php";
// Script file of the edit form
$liste["edit_file"] = "web_folder_edit.php";
// Script File of the delete script
$liste["delete_file"] = "web_folder_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' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
$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",
'filters' => array( 0 => array( 'event' => 'SHOW',
'type' => 'IDNTOUTF8')
),
'formtype' => "SELECT",
'op' => "=",
'prefix' => "",
'suffix' => "",
'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain",
'keyfield'=> 'domain_id',
'valuefield'=> 'domain'
),
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "path",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
?>
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_list_web_sites_stats">
<div class="pnl_listarea">
<fieldset><legend><tmpl_var name="list_head_txt"></legend>
<table class="list">
<thead>
<tr class="caption">
<th class="tbl_col_domain" scope="col"><tmpl_var name="domain_txt"></th>
<th class="tbl_col_web_traffic_this_month" scope="col"><tmpl_var name="this_month_txt"></th>
<th class="tbl_col_web_traffic_last_month" scope="col"><tmpl_var name="last_month_txt"></th>
<th class="tbl_col_web_traffic_this_year" scope="col"><tmpl_var name="this_year_txt"></th>
<th class="tbl_col_web_traffic_last_year" scope="col"><tmpl_var name="last_year_txt"></th>
<th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
</tr>
<tr class="filter">
<td class="tbl_col_domain"><input type="text" name="search_domain" value="{tmpl_var name='search_domain'}" /></td>
<td class="tbl_col_this_month"></td>
<td class="tbl_col_last_month"></td>
<td class="tbl_col_this_year"></td>
<td class="tbl_col_last_year"></td>
<td class="tbl_col_buttons">
<button type="button" class="button icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','sites/web_sites_stats.php');"><span>{tmpl_var name="filter_txt"}</span></button>
</td>
</tr>
</thead>
<tbody>
<tmpl_loop name="records">
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td class="tbl_col_domain"><a target="_blank" href="http://{tmpl_var name="domain"}/stats">{tmpl_var name="domain"}</a></td>
<td class="tbl_col_this_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_month"}</a></td>
<td class="tbl_col_last_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_month"}</a></td>
<td class="tbl_col_this_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_year"}</a></td>
<td class="tbl_col_last_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_year"}</a></td>
<td class="tbl_col_buttons"></td>
</tr>
</tmpl_loop>
<tmpl_unless name="records">
<tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td colspan="6">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
</tr>
</tmpl_unless>
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td class="tbl_col_domain"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_txt"}</a></td>
<td class="tbl_col_this_month"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_month"} MB</a></td>
<td class="tbl_col_last_month"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_month"} MB</a></td>
<td class="tbl_col_this_year"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_year"} MB</a></td>
<td class="tbl_col_last_year"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_year"} MB</a></td>
<td class="tbl_col_buttons"></td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="tbl_footer tbl_paging" colspan="6"><tmpl_var name="paging"></td>
</tr>
</tfoot>
</table>
</fieldset>
</div>
</div>
<?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/web_aliasdomain.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('sites');
// Loading classes
$app->uses('tpl,tform,tform_actions,tools_sites');
$app->load('tform_actions');
class page_action extends tform_actions {
var $parent_domain_record;
function onShowNew() {
global $app, $conf;
// we will check only users, not admins
if($_SESSION["s"]["user"]["typ"] == 'user') {
if(!$app->tform->checkClientLimit('limit_web_aliasdomain', "type = 'alias'")) {
$app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]);
}
if(!$app->tform->checkResellerLimit('limit_web_aliasdomain', "type = 'alias'")) {
$app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]);
}
}
parent::onShowNew();
}
function onShowEnd() {
global $app, $conf;
/*
* Now we have to check, if we should use the domain-module to select the domain
* or not
*/
$app->uses('ini_parser,getconf');
$settings = $app->getconf->get_global_config('domains');
if ($settings['use_domain_module'] == 'y') {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domain_select = '';
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
foreach( $domains as $domain) {
$domain_select .= "<option value=" . $domain['domain_id'] ;
if ($domain['domain'] == $this->dataRecord["domain"]) {
$domain_select .= " selected";
}
$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
}
}
else {
/*
* We have no domains in the domain-list. This means, we can not add ANY new domain.
* To avoid, that the variable "domain_option" is empty and so the user can
* free enter a domain, we have to create a empty option!
*/
$domain_select .= "<option value=''></option>\r\n";
}
$app->tpl->setVar("domain_option", $domain_select);
}
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// Directive Snippets
$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
$proxy_directive_snippets_txt = '';
if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
foreach($proxy_directive_snippets as $proxy_directive_snippet){
$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
}
}
if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
}
parent::onShowEnd();
}
function onSubmit() {
global $app, $conf;
/* check if the domain module is used - and check if the selected domain can be used! */
$app->uses('ini_parser,getconf');
$settings = $app->getconf->get_global_config('domains');
if ($settings['use_domain_module'] == 'y') {
$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
if(!$domain_check) {
// invalid domain selected
$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
} else {
$this->dataRecord['domain'] = $domain_check;
}
}
// nginx: if redirect type is proxy and redirect path is no URL, display error
if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'], 0, 1) == '/'){
$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
}
// Get the record of the parent domain
$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), @$this->dataRecord["parent_domain_id"]);
if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
// Set a few fixed values
$this->dataRecord["type"] = 'alias';
$this->dataRecord["server_id"] = $parent_domain["server_id"];
//$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
$this->parent_domain_record = $parent_domain;
//* make sure that the domain is lowercase
if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
$app->db->query('UPDATE web_domain SET sys_groupid = ? WHERE domain_id = ?', $this->parent_domain_record['sys_groupid'], $this->id);
}
function onAfterUpdate() {
global $app, $conf;
//* Check if parent domain has been changed
if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) {
//* Update the domain owner
$app->db->query('UPDATE web_domain SET sys_groupid = ? WHERE domain_id = ?', $this->parent_domain_record['sys_groupid'], $this->id);
//* Update the old website, so that the vhost alias gets removed
//* We force the update by inserting a transaction record without changes manually.
$old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $this->oldDataRecord['domain_id']);
$app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
}
}
}
$page = new page_action;
$page->onLoad();
?>
This diff is collapsed.
<?php
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/web_sites_stats.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('sites');
$app->uses('functions');
$app->load('listform_actions');
class list_action extends listform_actions {
private $sum_this_month = 0;
private $sum_this_year = 0;
private $sum_last_month = 0;
private $sum_last_year = 0;
function prepareDataRow($rec)
{
global $app;
$rec = $app->listform->decode($rec);
//* Alternating datarow colors
$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
$rec['bgcolor'] = $this->DataRowColor;
//* Set the statistics colums
//** Traffic of the current month
$tmp_year = date('Y');
$tmp_month = date('m');
$tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'");
// $rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
// $this->sum_this_month += ($tmp_rec['t']/1024/1024);
$rec['this_month'] = $app->functions->formatBytes($tmp_rec['t']);
$this->sum_this_month += $app->functions->formatBytes($tmp_rec['t']);
//** Traffic of the current year
$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'");
// $rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
// $this->sum_this_year += ($tmp_rec['t']/1024/1024);
$rec['this_year'] = $app->functions->formatBytes($tmp_rec['t']);
$this->sum_this_year += $app->functions->formatBytes($tmp_rec['t']);
//** Traffic of the last month
$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'");
// $rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
// $this->sum_last_month += ($tmp_rec['t']/1024/1024);
$rec['last_month'] = $app->functions->formatBytes($tmp_rec['t']);
$this->sum_last_month += $app->functions->formatBytes($tmp_rec['t']);
//** Traffic of the last year
$tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'");
// $rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
// $this->sum_last_year += ($tmp_rec['t']/1024/1024);
$rec['last_year'] = $app->functions->formatBytes($tmp_rec['t']);
$this->sum_last_year += $app->functions->formatBytes($tmp_rec['t']);
//* The variable "id" contains always the index variable
$rec['id'] = $rec[$this->idx_key];
return $rec;
}
function onShowEnd()
{
global $app;
$app->tpl->setVar('sum_this_month', number_format($app->functions->intval($this->sum_this_month), 0, '.', ' '));
$app->tpl->setVar('sum_this_year', number_format($app->functions->intval($this->sum_this_year), 0, '.', ' '));
$app->tpl->setVar('sum_last_month', number_format($app->functions->intval($this->sum_last_month), 0, '.', ' '));
$app->tpl->setVar('sum_last_year', number_format($app->functions->intval($this->sum_last_year), 0, '.', ' '));
$app->tpl->setVar('sum_txt', $app->listform->lng('sum_txt'));
$app->tpl_defaults();
$app->tpl->pparse();
}
function getQueryString() {
global $app;
$sql_where = '';
//* Generate the search sql
if($app->listform->listDef['auth'] != 'no') {
if($_SESSION['s']['user']['typ'] == "admin") {
$sql_where = '';
} else {
$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and';
//$sql_where = $app->tform->getAuthSQL('r').' and';
}
}
if($this->SQLExtWhere != '') {
$sql_where .= ' '.$this->SQLExtWhere.' and';
}
$sql_where = $app->listform->getSearchSQL($sql_where);
if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
$app->tpl->setVar($app->listform->searchValues);
$order_by_sql = $this->SQLOrderBy;
//* Generate SQL for paging
$limit_sql = $app->listform->getPagingSQL($sql_where);
$app->tpl->setVar('paging', $app->listform->pagingHTML);
$extselect = '';
$join = '';
if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
$order = str_replace(' DESC', '', $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
list($tmp_table, $order) = explode('.', $order);
if($order == 'web_traffic_last_month'){
$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_month', 'calctraffic', $order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
} elseif($order == 'web_traffic_this_month'){
$tmp_year = date('Y');
$tmp_month = date('m');
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_month', 'calctraffic', $order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
} elseif($order == 'web_traffic_last_year'){
$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_year', 'calctraffic', $order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
} elseif($order == 'web_traffic_this_year'){
$tmp_year = date('Y');
$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_year', 'calctraffic', $order_by_sql);
$order_by_sql = "GROUP BY domain ".$order_by_sql;
}
}
if($this->SQLExtSelect != '') {
if(substr($this->SQLExtSelect, 0, 1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect;
$extselect .= $this->SQLExtSelect;
}
$table_selects = array();
$table_selects[] = trim($app->listform->listDef['table']).'.*';
$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
if($app->listform->listDef['additional_tables'] != ''){
$additional_tables = explode(',', $app->listform->listDef['additional_tables']);
foreach($additional_tables as $additional_table){
$table_selects[] = trim($additional_table).'.*';
}
}
$select = implode(', ', $table_selects);
$sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
return $sql;
}
}
$list = new list_action;
$list->SQLExtWhere = "(web_domain.type = 'vhost' or web_domain.type = 'vhostsubdomain')";
$list->SQLOrderBy = 'ORDER BY web_domain.domain';
$list->onLoad();
?>
......@@ -389,18 +389,15 @@ class page_action extends tform_actions {
$app->uses('ini_parser,getconf');
$settings = $app->getconf->get_global_config('domains');
if ($settings['use_domain_module'] == 'y') {
$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
if(!$domain_check) {
// invalid domain selected
$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
} else {
$this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
$this->dataRecord['domain'] = $domain_check;
}
} else {
$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
}
$this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
if(substr($this->dataRecord['web_folder'], 0, 1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 1);
if(substr($this->dataRecord['web_folder'], -1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 0, -1);
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment