Commit cc65688b authored by hellkat's avatar hellkat
Browse files

Merged revisions 3845-3876 and 3879-3918 from stable branch.

parent 63527811
......@@ -1024,7 +1024,7 @@ class installer_dist extends installer_base {
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
//* and create the symlink
if($this->is_update == false) {
//if($this->is_update == false) {
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
......@@ -1039,17 +1039,17 @@ class installer_dist extends installer_base {
replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
*/
if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
if(!is_dir('/var/www/php-fcgi-scripts/ispconfig')) exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
if(!is_link('/var/www/ispconfig')) exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
}
}
//}
//}
}
if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
......@@ -1228,7 +1228,7 @@ class installer_dist extends installer_base {
$existing_cron_jobs = file('crontab.txt');
$cron_jobs = array(
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log'
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
);
// remove existing ispconfig cronjobs, in case the syntax has changed
......@@ -1247,7 +1247,7 @@ class installer_dist extends installer_base {
}
exec('touch /var/log/ispconfig/cron.log');
exec('chmod 666 /var/log/ispconfig/cron.log');
exec('chmod 660 /var/log/ispconfig/cron.log');
}
}
......
......@@ -610,8 +610,8 @@ class installer extends installer_base
$this->write_config_file("$vhost_conf_dir/apps.vhost", $content);
if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') )
{
//if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') )
//{
$content = rf('tpl/apache_apps_fcgi_starter.master');
$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
......@@ -621,7 +621,7 @@ class installer extends installer_base
exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
}
//}
}
if($conf['nginx']['installed'] == true){
$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
......@@ -946,11 +946,11 @@ class installer extends installer_base
$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
@mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
chmod('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', 0755);
symlink($install_dir.'/interface/web','/var/www/ispconfig');
@symlink($install_dir.'/interface/web','/var/www/ispconfig');
exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
}
}
......
......@@ -1078,7 +1078,7 @@ class installer_dist extends installer_base {
wf("$vhost_conf_dir/ispconfig.vhost", $content);
if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
//if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
......@@ -1088,7 +1088,7 @@ class installer_dist extends installer_base {
exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
}
//}
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
//* and create the symlink
......@@ -1280,7 +1280,7 @@ class installer_dist extends installer_base {
$existing_cron_jobs = file('crontab.txt');
$cron_jobs = array(
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log'
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
);
// remove existing ispconfig cronjobs, in case the syntax has changed
......@@ -1299,7 +1299,7 @@ class installer_dist extends installer_base {
}
exec('touch /var/log/ispconfig/cron.log');
exec('chmod 666 /var/log/ispconfig/cron.log');
exec('chmod 660 /var/log/ispconfig/cron.log');
}
}
......
......@@ -568,23 +568,6 @@ class installer_base {
}
}
$config_dir = $conf['mailman']['config_dir'].'/';
$full_file_name = $config_dir.'virtual_to_transport.sh';
//* Backup exiting virtual_to_transport.sh script
if(is_file($full_file_name)) {
copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
}
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
chgrp($full_file_name,'list');
chmod($full_file_name,0750);
if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
$virtual_domains = '';
if($status == 'update')
{
......@@ -610,6 +593,25 @@ class installer_base {
$content = str_replace('{virtual_domains}', $virtual_domains, $content);
wf($full_file_name, $content);
//* Write virtual_to_transport.sh script
$config_dir = $conf['mailman']['config_dir'].'/';
$full_file_name = $config_dir.'virtual_to_transport.sh';
//* Backup exiting virtual_to_transport.sh script
if(is_file($full_file_name)) {
copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
}
if(is_dir('/etc/mailman')) {
copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
chgrp($full_file_name,'list');
chmod($full_file_name,0750);
}
//* Create aliasaes
exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
}
public function configure_postfix($options = '') {
......@@ -732,11 +734,13 @@ class installer_base {
touch($config_dir.'/body_checks');
//* Create the mailman files
exec('mkdir -p /var/lib/mailman/data');
if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data');
if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
exec('postalias /var/lib/mailman/data/aliases');
if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman');
exec('postmap /var/lib/mailman/data/virtual-mailman');
if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
//* Make a backup copy of the main.cf file
copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
......@@ -1921,16 +1925,16 @@ class installer_base {
symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
}
}
if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
@mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
symlink($install_dir.'/interface/web','/var/www/ispconfig');
@symlink($install_dir.'/interface/web','/var/www/ispconfig');
exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
}
//}
}
if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
......@@ -2116,7 +2120,7 @@ class installer_base {
$existing_cron_jobs = file('crontab.txt');
$cron_jobs = array(
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> '.$conf['ispconfig_log_dir'].'/cron.log'
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
);
// remove existing ispconfig cronjobs, in case the syntax has changed
......@@ -2135,7 +2139,7 @@ class installer_base {
}
touch($conf['ispconfig_log_dir'].'/cron.log');
chmod($conf['ispconfig_log_dir'].'/cron.log', 0666);
chmod($conf['ispconfig_log_dir'].'/cron.log', 0660);
}
......
......@@ -20,6 +20,6 @@ INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (N
-- --------------------------------------------------------
ALTER TABLE `web_domain` ADD `ssl_key` MEDIUMTEXT NOT NULL AFTER `ssl_bundle`;
ALTER TABLE `mail_user` ADD `disabledoveadm` enum('n','y') NOT NULL default 'n' AFTER `disablelda`
ALTER TABLE `mail_user` ADD `disabledoveadm` enum('n','y') NOT NULL default 'n' AFTER `disablelda`;
......@@ -296,7 +296,7 @@ CREATE TABLE `client_template` (
`limit_shell_user` int(11) NOT NULL default '0',
`ssh_chroot` varchar(255) NOT NULL DEFAULT 'no',
`limit_webdav_user` int(11) NOT NULL default '0',
`limit_aps` int(11) NOT NULL DEFAULT '0',
`limit_aps` int(11) NOT NULL DEFAULT '-1',
`limit_dns_zone` int(11) NOT NULL default '-1',
`limit_dns_slave_zone` int(11) NOT NULL default '-1',
`limit_dns_record` int(11) NOT NULL default '-1',
......@@ -2169,6 +2169,6 @@ INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`,
-- Dumping data for table `sys_config`
--
INSERT INTO sys_config VALUES ('1','db','db_version','3.0.5');
INSERT INTO sys_config VALUES ('1','db','db_version','3.0.5.1');
SET FOREIGN_KEY_CHECKS = 1;
\ No newline at end of file
......@@ -50,3 +50,5 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
Alias /awstats-icon "/usr/share/awstats/icon"
NameVirtualHost *:80
NameVirtualHost *:443
\ No newline at end of file
......@@ -28,18 +28,19 @@ NameVirtualHost *:{vhost_port}
IPCCommTimeout 7200
</IfModule>
# <IfModule mod_php5.c>
# DocumentRoot /usr/local/ispconfig/interface/web/
# AddType application/x-httpd-php .php
# <Directory /usr/local/ispconfig/interface/web>
# # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
# Options FollowSymLinks
# AllowOverride None
# Order allow,deny
# Allow from all
# php_value magic_quotes_gpc 0
# </Directory>
# </IfModule>
<IfModule mpm_itk_module>
DocumentRoot /usr/local/ispconfig/interface/web/
AssignUserId ispconfig ispconfig
AddType application/x-httpd-php .php
<Directory /usr/local/ispconfig/interface/web>
# php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
php_value magic_quotes_gpc 0
</Directory>
</IfModule>
# ErrorLog /var/log/apache2/error.log
# CustomLog /var/log/apache2/access.log combined
......
<?php
/*
Copyright (c) 2007 - 2012, Till Brehm, projektfarm Gmbh
Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -56,7 +56,7 @@ $revision = str_replace(array('Revision:','$',' '), '', $svn_revision);
//** Application
define('ISPC_APP_TITLE', 'ISPConfig');
define('ISPC_APP_VERSION', '3.0.5');
define('ISPC_APP_VERSION', '3.0.5.1');
define('DEVSYSTEM', 0);
......
......@@ -46,7 +46,7 @@ server {
fastcgi_pass unix:{fpm_socket};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
......
......@@ -28,7 +28,7 @@ server {
fastcgi_pass unix:{fpm_socket};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
......
......@@ -129,7 +129,7 @@ $do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in
if($do_backup == 'yes') {
//* Create the backup directory
$backup_path = '/var/backup/ispconfig_'.date('Y-m-d_H-i');
$backup_path = '/var/backup/ispconfig_'.@date('Y-m-d_H-i');
$conf['backup_path'] = $backup_path;
exec("mkdir -p $backup_path");
exec("chown root:root $backup_path");
......
......@@ -728,6 +728,9 @@ class ApsGUIController extends ApsBase
// Using parse_url() to filter malformed URLs
$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$icon);
// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
$pkg['Icon'] = $path;
}
else $pkg['Icon'] = '';
......@@ -741,6 +744,8 @@ class ApsGUIController extends ApsBase
// Using parse_url() to filter malformed URLs
$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$screen['path']);
// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
$pkg['Screenshots'][] = array('ScreenPath' => $path,
'ScreenDescription' => htmlspecialchars(trim((string)$screen->description)));
......
......@@ -44,7 +44,7 @@ class db extends mysqli
private $errorNumber = 0; // last error number
public $errorMessage = ''; // last error message
private $errorLocation = '';// last error location
public $show_error_messages = true; // false in server, true in interface
public $show_error_messages = false; // false in server, true in interface
private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
// constructor
......@@ -60,7 +60,8 @@ class db extends mysqli
$this->dbClientFlags = $conf[$prefix.'db_client_flags'];
parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
$try = 0;
while(!is_null($this->connect_error) && $try < 5) {
//while(!is_null($this->connect_error) && $try < 5) {
while(mysqli_connect_error() && $try < 5) {
if($try > 0) sleep(1);
$try++;
......@@ -69,7 +70,9 @@ class db extends mysqli
parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
}
if(is_null($this->connect_error)) $this->isConnected = true;
//if(is_null($this->connect_error)) $this->isConnected = true;
//else return false;
if(!mysqli_connect_error()) $this->isConnected = true;
else return false;
$this->setCharacterEncoding();
......@@ -81,8 +84,9 @@ class db extends mysqli
// error handler
public function updateError($location) {
global $app;
global $app, $conf;
/*
if(!is_null($this->connect_error)) {
$this->errorNumber = $this->connect_errno;
$this->errorMessage = $this->connect_error;
......@@ -90,12 +94,21 @@ class db extends mysqli
$this->errorNumber = $this->errno;
$this->errorMessage = $this->error;
}
*/
if(mysqli_connect_error()) {
$this->errorNumber = mysqli_connect_errno();
$this->errorMessage = mysqli_connect_error();
} else {
$this->errorNumber = mysqli_errno($this);
$this->errorMessage = mysqli_error($this);
}
$this->errorLocation = $location;
if($this->errorNumber) {
$error_msg = $this->errorLocation .' '. $this->errorMessage;
// This right here will allow us to use the samefile for server & interface
if($this->show_error_messages) {
// This right here will allow us to use the same file for server & interface
if($this->show_error_messages && $conf['demo_mode'] === false) {
echo $error_msg;
} else if(is_object($app) && method_exists($app, 'log')) {
$app->log($error_msg, LOGLEVEL_WARN);
......@@ -110,6 +123,7 @@ class db extends mysqli
}
public function query($queryString) {
global $conf;
if($this->isConnected == false) return false;
$try = 0;
do {
......@@ -131,7 +145,7 @@ class db extends mysqli
} while($ok == false);
$this->queryId = parent::query($queryString);
$this->updateError('DB::query('.$queryString.') -> mysqli_query');
if($this->errorNumber) debug_print_backtrace();
if($this->errorNumber && $conf['demo_mode'] === false) debug_print_backtrace();
if(!$this->queryId) {
return false;
}
......@@ -176,11 +190,11 @@ class db extends mysqli
// returns number of rows returned by the last select query
public function numRows() {
return $this->queryId->num_rows;
return intval($this->queryId->num_rows);
}
public function affectedRows() {
return $this->queryId->affected_rows;
return intval($this->queryId->affected_rows);
}
// returns mySQL insert id
......
......@@ -171,8 +171,15 @@ class listform_actions {
$order_by_sql = str_replace('client_id','c.contact_name',$order_by_sql);
} elseif($order == 'parent_domain_id'){
$join .= ' LEFT JOIN web_domain as wd ON '.$app->listform->listDef['table'].'.parent_domain_id = wd.domain_id ';
$order_by_sql = str_replace('parent_domain_id','wd.domain',$order_by_sql);
$sql_where = str_replace('type',$app->listform->listDef['table'].'.type',$sql_where);
//$order_by_sql = str_replace(' domain', ' '.$app->listform->listDef['table'].'.domain',$order_by_sql);
//$order_by_sql = str_replace('parent_domain_id','wd.domain',$order_by_sql);
$order_by_sql = preg_replace('@( |,|^)(domain)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $order_by_sql);
$order_by_sql = preg_replace('@( |,|^)(parent_domain_id)( |,|$)@', '$1wd.domain$3', $order_by_sql);
//$sql_where = str_replace('type',$app->listform->listDef['table'].'.type',$sql_where);
//$sql_where = str_replace(' domain',' '.$app->listform->listDef['table'].'.domain',$sql_where);
$sql_where = preg_replace('@( |,|^)(type)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $sql_where);
$sql_where = preg_replace('@( |,|^)(domain)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $sql_where);
} elseif($order == 'sys_groupid'){
$join .= ' LEFT JOIN sys_group as sg ON '.$app->listform->listDef['table'].'.sys_groupid = sg.groupid ';
$order_by_sql = str_replace('sys_groupid','sg.name',$order_by_sql);
......
......@@ -467,6 +467,8 @@ class remoting_lib {
}
break;
case 'UNIQUE':
if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
if($this->action == 'NEW') {
$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
if($num_rec["number"] > 0) {
......@@ -488,6 +490,7 @@ class remoting_lib {
}
}
}
}
break;
case 'NOTEMPTY':
if(empty($field_value)) {
......@@ -571,7 +574,18 @@ class remoting_lib {
}
break;
case 'ISIP':
if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
if($validator['allowempty'] == 'y' && $field_value == '') {
//* Do nothing
} else {
//* Check if its a IPv4 or IPv6 address
if(isset($validator['separator']) && $validator['separator'] != '') {
//* When the field may contain several IP addresses, split them by the char defined as separator
$field_value_array = explode($validator['separator'],$field_value);
} else {
$field_value_array[] = $field_value;
}
foreach($field_value_array as $field_value) {
if(function_exists('filter_var')) {
if(!filter_var($field_value,FILTER_VALIDATE_IP)) {
$errmsg = $validator['errmsg'];
......@@ -599,6 +613,8 @@ class remoting_lib {
}
}
}
}
}
break;
case 'RANGE':
//* Checks if the value is within the given range or above / below a value
......@@ -802,18 +818,24 @@ class remoting_lib {
$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
return $app->db->queryOneRecord($sql);
} elseif (@is_array($primary_id)) {
$sql_offset = 0;
$sql_limit = 0;
$sql_where = '';
foreach($primary_id as $key => $val) {
$key = $app->db->quote($key);
$val = $app->db->quote($val);
if(stristr($val,'%')) {
if($key == '#OFFSET#') $sql_offset = $app->functions->intval($val);
elseif($key == '#LIMIT#') $sql_limit = $app->functions->intval($val);
elseif(stristr($val,'%')) {
$sql_where .= "$key like '$val' AND ";
} else {
$sql_where .= "$key = '$val' AND ";
}
}
$sql_where = substr($sql_where,0,-5);
if($sql_where == '') $sql_where = '1';
$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where;
if($sql_offset >= 0 && $sql_limit > 0) $sql .= ' LIMIT ' . $sql_offset . ',' . $sql_limit;
return $app->db->queryAllRecords($sql);
} else {
$this->errorMessage = 'The ID must be either an integer or an array.';
......
......@@ -465,7 +465,7 @@ class tools_monitor {
$html .= '<p>Problem, there are no rules listed for the server</p>';
}
else {
$html = nl2br($data['output']);
$html .= nl2br($data['output']);
}
$html .= '</div></div>';
} else {
......
......@@ -137,7 +137,7 @@ class validate_domain {
//if($check['cnt'] > 0) return false;
// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (`domain` = '" . $app->db->quote($domain_name) . "'".$additional_sql1.") AND `server_id` = ".$domain['server_id']." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql1 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (`domain` = '" . $app->db->quote($domain_name) . "'".$additional_sql1.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql1 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
if(is_array($checks) && !empty($checks)){
foreach($checks as $check){
......@@ -207,7 +207,7 @@ class validate_domain {
//$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
//if($check['cnt'] > 0) return false;
// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "'".$additional_sql2.") AND `server_id` = ".$domain['server_id']." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql2 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "'".$additional_sql2.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql2 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
if(is_array($checks) && !empty($checks)){
foreach($checks as $check){
if($domain['ip_address'] == '*') return false;
......
......@@ -11,11 +11,11 @@ $wb['number_format_thousands_sep'] = '';
$wb['error_301'] = 'Modul není povolen pro současného uživatele.';
$wb['error_302'] = 'Neplatný modul.';
$wb['error_1001'] = 'Uživatelské jméno a heslo nemohou být prázdné !';
$wb['error_1002'] = 'Uživatelské jméno a/nebo heslo nejsou správné !';
$wb['error_1003'] = 'Uživatelské jméno je neaktivní!';
$wb['delete_confirmation'] = 'Skutečně chcete smazat tento záznam?';