From 49df59c9fb814834bfca91fc8efc0f2248b6a0e5 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Mon, 15 Oct 2012 07:26:06 -0400 Subject: [PATCH] Updated German language files. --- interface/lib/classes/aps_guicontroller.inc.php | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 15 deletions(-) diff --git a/interface/lib/classes/aps_guicontroller.inc.php b/interface/lib/classes/aps_guicontroller.inc.php index 55d6db0..cec49d7 100644 --- a/interface/lib/classes/aps_guicontroller.inc.php +++ b/interface/lib/classes/aps_guicontroller.inc.php @@ -87,7 +87,7 @@ */ private function getCustomerIDFromDomain($domain) { - $customerid = ''; + $customerid = 0; $customerdata = $this->db->queryOneRecord("SELECT client_id FROM sys_group, web_domain WHERE web_domain.sys_groupid = sys_group.groupid @@ -199,18 +199,18 @@ { global $app; - include_once(ISPC_WEB_PATH.'/sites/tools.inc.php'); - + $app->uses('tools_sites'); + $webserver_id = 0; $websrv = $this->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '".$this->db->quote($settings['main_domain'])."';"); if(!empty($websrv)) $webserver_id = $websrv['server_id']; $customerid = $this->getCustomerIDFromDomain($settings['main_domain']); - if(empty($settings) || empty($customerid) || empty($webserver_id)) return false; + if(empty($settings) || empty($webserver_id)) return false; //* Get server config of the web server $this->app->uses("getconf"); - $web_config = $this->app->getconf->get_server_config(intval($websrv["server_id"]),'web'); + $web_config = $this->app->getconf->get_server_config($app->functions->intval($websrv["server_id"]),'web'); //* Set mysql mode to php-fcgi and enable suexec in website on apache servers if($web_config['server_type'] == 'apache') { @@ -231,15 +231,15 @@ $tmp = array(); $tmp['parent_domain_id'] = $websrv['domain_id']; $tmp['sys_groupid'] = $websrv['sys_groupid']; - $dbname_prefix = replacePrefix($global_config['dbname_prefix'], $tmp); - $dbuser_prefix = replacePrefix($global_config['dbuser_prefix'], $tmp); + $dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $tmp); + $dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $tmp); unset($tmp); //* get the default database server of the client $client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']); if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) { $mysql_db_server_id = $client['default_dbserver']; - $dbserver_config = $web_config = $app->getconf->get_server_config(intval($mysql_db_server_id),'server'); + $dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id),'server'); $mysql_db_host = $dbserver_config['ip_address']; $mysql_db_remote_access = 'y'; $mysql_db_remote_ips = $dbserver_config['ip_address']; @@ -253,16 +253,26 @@ //* Find a free db name for the app for($n = 1; $n <= 1000; $n++) { $mysql_db_name = $dbname_prefix.'aps'.$n; + $tmp = $app->db->queryOneRecord("SELECT count(database_id) as number FROM web_database WHERE database_name = '".$app->db->quote($mysql_db_name)."'"); + if($tmp['number'] == 0) break; + } + //* Find a free db username for the app + for($n = 1; $n <= 1000; $n++) { $mysql_db_user = $dbuser_prefix.'aps'.$n; - $tmp = $app->db->queryOneRecord("SELECT count(database_id) as number FROM web_database WHERE database_name = '".$app->db->quote($mysql_db_user)."' OR database_user = '".$app->db->quote($mysql_db_name)."'"); + $tmp = $app->db->queryOneRecord("SELECT count(database_user_id) as number FROM web_database_user WHERE database_user = '".$app->db->quote($mysql_db_user)."'"); if($tmp['number'] == 0) break; } $mysql_db_password = $settings['main_database_password']; + //* Create the mysql database user + $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_password`) + VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', 0, '$mysql_db_user', PASSWORD('$mysql_db_password'))"; + $mysql_db_user_id = $app->db->datalogInsert('web_database_user', $insert_data, 'database_user_id'); + //* Create the mysql database - $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_user`, `database_password`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`) - VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', $mysql_db_server_id, ".$websrv['domain_id'].", 'mysql', '$mysql_db_name', '$mysql_db_user', PASSWORD('$mysql_db_password'), '', '$mysql_db_remote_access', '$mysql_db_remote_ips', ".$websrv['backup_copies'].", 'y', '".$websrv['backup_interval']."')"; + $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`) + VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', $mysql_db_server_id, ".$websrv['domain_id'].", 'mysql', '$mysql_db_name', '$mysql_db_user_id', 0, '', '$mysql_db_remote_access', '$mysql_db_remote_ips', ".$websrv['backup_copies'].", 'y', '".$websrv['backup_interval']."')"; $app->db->datalogInsert('web_database', $insert_data, 'database_id'); //* Add db details to package settings @@ -306,6 +316,15 @@ $datalog = array('Instance_id' => $instanceid, 'server_id' => $webserver_id); $this->db->datalogSave('aps', 'DELETE', 'id', $instanceid, array(), $datalog); */ + + $sql = "SELECT web_database.database_id as database_id, web_database.database_user_id as `database_user_id` FROM aps_instances_settings, web_database WHERE aps_instances_settings.value = web_database.database_name AND aps_instances_settings.value = aps_instances_settings.name = 'main_database_name' AND aps_instances_settings.instance_id = ".$instanceid." LIMIT 0,1"; + $tmp = $this->db->queryOneRecord($sql); + if($tmp['database_id'] > 0) $this->db->datalogDelete('web_database', 'database_id', $tmp['database_id']); + + $database_user = $tmp['database_user_id']; + $tmp = $this->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'"); + if($tmp['cnt'] < 1) $this->db->datalogDelete('web_database_user', 'database_user_id', $database_user); + $this->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_REMOVE, 'id', $instanceid); } @@ -327,6 +346,11 @@ $datalog = array('instance_id' => $instanceid, 'server_id' => $webserver_id); $this->db->datalogSave('aps', 'INSERT', 'id', $instanceid, array(), $datalog); */ + + $sql = "SELECT web_database.database_id as database_id FROM aps_instances_settings, web_database WHERE aps_instances_settings.value = web_database.database_name AND aps_instances_settings.value = aps_instances_settings.name = 'main_database_name' AND aps_instances_settings.instance_id = ".$instanceid." LIMIT 0,1"; + $tmp = $this->db->queryOneRecord($sql); + if($tmp['database_id'] > 0) $this->db->datalogDelete('web_database', 'database_id', $tmp['database_id']); + $this->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_INSTALL, 'id', $instanceid); } @@ -425,6 +449,8 @@ */ public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array()) { + global $app; + $ret = array(); $input = array(); $error = array(); @@ -542,12 +568,12 @@ { if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password') { - if(intval($setting['SettingMinLength']) != 0 - && strlen($postinput[$setting_id]) < intval($setting['SettingMinLength'])) + if($app->functions->intval($setting['SettingMinLength'], true) != 0 + && strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true)) $temp_errstr = sprintf($this->app->lng('error_short_value_for'), $setting['setting_name']); - if(intval($setting['SettingMaxLength']) != 0 - && strlen($postinput[$setting_id]) > intval($setting['SettingMaxLength'])) + if($app->functions->intval($setting['SettingMaxLength'], true) != 0 + && strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true)) $temp_errstr = sprintf($this->app->lng('error_long_value_for'), $setting['setting_name']); if(isset($setting['SettingRegex']) -- Gitblit v1.9.1