From ad31b07a041abb98e2b691dd8db1a45c71181de2 Mon Sep 17 00:00:00 2001 From: "Florian Aders (EleRas)" Date: Sat, 23 Oct 2010 10:20:23 +0000 Subject: [PATCH] Reverting the multiserver-stuff, we'll do this inside the branch --- admin_clients.php | 334 ------------------ admin_customers.php | 97 +---- admin_ipsandports.php | 6 +- admin_phpsettings.php | 54 +-- admin_updates.php | 2 +- customer_domains.php | 12 +- customer_email.php | 4 +- customer_extras.php | 12 +- customer_ftp.php | 4 +- install/froxlor.sql | 24 +- install/install.php | 17 +- install/lng/english.lng.php | 4 - install/lng/german.lng.php | 4 - .../updates/froxlor/0.9/update_0.9.inc.php | 129 ------- install/updates/preconfig.php | 17 + .../preconfig/0.9/preconfig_0.9.inc.php | 8 - .../database/function.correctMysqlUsers.php | 26 +- .../formfields/function.buildFormEx.php | 8 +- .../function.getFormGroupOutput.php | 26 +- .../formfields/function.processForm.php | 4 +- .../formfields/function.saveFormField.php | 4 +- lib/functions/froxlor/function.inserttask.php | 144 ++++---- .../settings/function.loadSettings.php | 50 +-- .../settings/function.saveSetting.php | 17 +- .../settings/function.storeSettingField.php | 6 +- .../function.storeSettingHostname.php | 17 +- .../function.storeSettingIpAddress.php | 13 +- .../function.storeSettingMysqlAccessHost.php | 6 +- lib/tables.inc.php | 3 +- lng/english.lng.php | 29 -- lng/german.lng.php | 7 - scripts/jobs/cron_tasks.php | 43 +-- 32 files changed, 169 insertions(+), 962 deletions(-) delete mode 100644 admin_clients.php diff --git a/admin_clients.php b/admin_clients.php deleted file mode 100644 index 28041023..00000000 --- a/admin_clients.php +++ /dev/null @@ -1,334 +0,0 @@ - (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Panel - * @version $Id$ - */ - -define('AREA', 'admin'); - -/** - * Include our init.php, which manages Sessions, Language etc. - */ - -require ("./lib/init.php"); - -if(isset($_POST['id'])) -{ - $id = intval($_POST['id']); -} -elseif(isset($_GET['id'])) -{ - $id = intval($_GET['id']); -} - -// only if multiserver is enabled -if((int)$settings['multiserver']['enabled'] == 1) -{ - if($page == 'clients' - || $page == 'overview') - { - if($action == '') - { - $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_clients"); - - $fields = array( - 'name' => $lng['admin']['froxlorclients']['name'], - 'enabled' => $lng['admin']['froxlorclients']['enabled'] - ); - $paging = new paging($userinfo, $db, TABLE_FROXLOR_CLIENTS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); - $froxlorclients = ''; - $result = $db->query("SELECT * FROM `" . TABLE_FROXLOR_CLIENTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); - $paging->setEntries($db->num_rows($result)); - $sortcode = $paging->getHtmlSortCode($lng); - $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); - $searchcode = $paging->getHtmlSearchCode($lng); - $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); - $i = 0; - $count = 0; - - while($row = $db->fetch_array($result)) - { - if($paging->checkDisplay($i)) - { - $row = htmlentities_array($row); - eval("\$froxlorclients.=\"" . getTemplate("froxlorclients/froxlorclients_client") . "\";"); - $count++; - } - $i++; - } - eval("echo \"" . getTemplate("froxlorclients/froxlorclients") . "\";"); - } - elseif($action == 'delete' - && $id != 0) - { - $client = froxlorclient::getInstance($userinfo, $db, $id); - - if(isset($_POST['send']) - && $_POST['send'] == 'send') - { - $log->logAction(ADM_ACTION, LOG_INFO, "deleted froxlor-client '" . $client->Get('name') . "'"); - $client->Delete(); - redirectTo($filename, Array('page' => $page, 's' => $s)); - } - else - { - ask_yesno('client_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $client->Get('name')); - } - } - elseif($action == 'add') - { - if(isset($_POST['send']) - && $_POST['send'] == 'send') - { - $name = validate($_POST['name'], 'name'); - $desc = validate($_POST['desc'], 'desc'); - $client_enabled = intval($_POST['enabled']); - - if($name == '') - { - standard_error(array('stringisempty', 'name')); - } - - if($desc == '') - { - standard_error(array('stringisempty', 'desc')); - } - - if($client_enabled != 1) { - $client_enabled = 0; - } - - $new_client = froxlorclient::getInstance($userinfo, $db, -1); - $new_client->Set('name', $name, true, false); - $new_client->Set('desc', $desc, true, false); - $new_client->Set('enabled', $client_enabled, true, true); - $cid = $new_client->Insert(); - - /** - * @TODO create a set of default settings, - * which depends on the client-type - * (implementation will follow) - */ - - $log->logAction(ADM_ACTION, LOG_WARNING, "added froxlor-client '" . $name . "' (#" . $cid . ")"); - redirectTo($filename, Array('page' => $page, 's' => $s)); - } - else - { - $client_enabled = makeyesno('enabled', '1', '0', '0'); - eval("echo \"" . getTemplate("froxlorclients/froxlorclients_add") . "\";"); - } - } - /** - * edit client-base data like name and description - */ - elseif($action == 'edit' - && $id != 0 - ) { - $client = froxlorclient::getInstance($userinfo, $db, $id); - - if(isset($_POST['send']) - && $_POST['send'] == 'send') - { - $name = validate($_POST['name'], 'name'); - $desc = validate($_POST['desc'], 'desc'); - $client_enabled = intval($_POST['enabled']); - - if($name == '') - { - standard_error(array('stringisempty', 'name')); - } - - if($desc == '') - { - standard_error(array('stringisempty', 'desc')); - } - - if($client_enabled != 1) { - $client_enabled = 0; - } - - $client->Set('name', $name, true, false); - $client->Set('desc', $desc, true, false); - $client->Set('enabled', $client_enabled, true, true); - $client->Update(); - - $log->logAction(ADM_ACTION, LOG_WARNING, "updated froxlor-client '" . $name . "' (#" . $id . ")"); - redirectTo($filename, Array('page' => $page, 's' => $s)); - } - else - { - $client_enabled = makeyesno('enabled', '1', '0', $client->Get('enabled')); - eval("echo \"" . getTemplate("froxlorclients/froxlorclients_edit") . "\";"); - } - } - /** - * view client details - */ - elseif($action == 'view' - && $id != 0 - ) { - $client = froxlorclient::getInstance($userinfo, $db, $id); - - /** - * for now, we'll only show a few links - */ - eval("echo \"" . getTemplate("froxlorclients/froxlorclients_view") . "\";"); - } - /** - * edit client settings - */ - elseif($action == 'settings' - && $id != 0 - ) { - $client = froxlorclient::getInstance($userinfo, $db, $id); - - /** - * @TODO - * - decide by client type (implementation will follow) - * what settings are going to be shown here - * (parameter $client_settings, has to be an array, - * see loadConfigArrayDir-function) - * - * now set are all possible client settings - */ - $client_settings = array( - 'froxlorclient', - 'webserver', - 'ssl', - 'fcgid', - 'perl', - 'statistics', - 'mail', - 'ftpserver', - 'nameserver', - 'logging', - 'dkim', - 'spf' - ); - - $settings_data = loadConfigArrayDir( - './actions/admin/settings/', - './actions/multiserver/clientsettings/', - $client_settings - ); - $settings = $client->getSettingsArray(); - - if(isset($_POST['send']) - && $_POST['send'] == 'send') - { - $_part = isset($_GET['part']) ? $_GET['part'] : ''; - - if($_part == '') - { - $_part = isset($_POST['part']) ? $_POST['part'] : ''; - } - - if($_part != '') - { - if($_part == 'all') - { - $settings_all = true; - $settings_part = false; - } - else - { - $settings_all = false; - $settings_part = true; - } - - $only_enabledisable = false; - } - else - { - $settings_all = false; - $settings_part = false; - $only_enabledisable = true; - } - - if(processFormEx( - $settings_data, - $_POST, - array('filename' => $filename, 'action' => $action, 'page' => $page), - $_part, - $settings_all, - $settings_part, - $only_enabledisable, - $id - ) - ) { - standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page)); - } - } - else - { - $_part = isset($_GET['part']) ? $_GET['part'] : ''; - - if($_part == '') - { - $_part = isset($_POST['part']) ? $_POST['part'] : ''; - } - - /** - * pass the client-id so the links "configuration" - * gets page=clients, action=settings and id={$id} - */ - $fields = buildFormEx($settings_data, $_part, $id); - - $settings_page = ''; - if($_part == '') - { - eval("\$settings_page .= \"" . getTemplate("froxlorclients/froxlorclient_settingsoverview") . "\";"); - } - else - { - eval("\$settings_page .= \"" . getTemplate("froxlorclients/froxlorclient_settings") . "\";"); - } - - eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";"); - eval("echo \$settings_page;"); - eval("echo \"" . getTemplate("froxlorclients/froxlorclient_settingsend") . "\";"); - } - } - /** - * deploy client to the destination server - */ - elseif($action == 'deploy' - && $id != 0 - ) { - $client = froxlorclient::getInstance($userinfo, $db, $id); - - if(isset($_POST['send']) - && $_POST['send'] == 'send') - { - // ... - - /** - * create task to deploy client, - * always use id of master-server - */ - inserttask('9', $id, 0); - } - else - { - /** - * @TODO - * - validate client-settings - * - validate client ssh connection (test?) - */ - echo "Here the client's settings and ssh-connection will be validated"; - } - } - } -} diff --git a/admin_customers.php b/admin_customers.php index e41fa098..702ff667 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -154,16 +154,6 @@ if($page == 'customers' if(isset($_POST['send']) && $_POST['send'] == 'send') { - /* - * get server-id from customer (multiserver-support) - */ - $server_id = $result['sid']; - - /* - * @TODO enter server-id as select-condition where necessary - * 16.10.2010 d00p - */ - $databases = $db->query("SELECT * FROM " . TABLE_PANEL_DATABASES . " WHERE customerid='" . (int)$id . "' ORDER BY `dbserver`"); $db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], ''); unset($db_root->password); @@ -292,13 +282,13 @@ if($page == 'customers' $admin_update_query.= " WHERE `adminid` = '" . (int)$result['adminid'] . "'"; $db->query($admin_update_query); $log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'"); - inserttask('1', $server_id); - inserttask('4', $server_id); + inserttask('1'); + inserttask('4'); if(isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) { - inserttask('6', $result['loginname'], $server_id); + inserttask('6', $result['loginname']); } /* @@ -348,18 +338,6 @@ if($page == 'customers' $customernumber = validate($_POST['customernumber'], 'customer number', '/^[A-Za-z0-9 \-]*$/Di'); $def_language = validate($_POST['def_language'], 'default language'); $diskspace = intval_ressource($_POST['diskspace']); - /* - * get server-id for customer (multiserver-support, default = 0) - * @TODO needs to be implemented in the interface, using 0 for now - * 16.10.2010 d00p - */ - //$server_id = intval_ressource($_POST['serverid']); - $server_id = 0; - - /* - * @TODO enter server-id as select-condition where necessary - * 16.10.2010 d00p - */ if(isset($_POST['diskspace_ul'])) { @@ -588,44 +566,7 @@ if($page == 'customers' $password = substr(md5(uniqid(microtime(), 1)), 12, 6); } - $result = $db->query("INSERT INTO - `" . TABLE_PANEL_CUSTOMERS . "` - SET - `adminid` = '" . (int)$userinfo['adminid'] . "', - `loginname` = '" . $db->escape($loginname) . "', - `password` = '" . md5($password) . "', - `name` = '" . $db->escape($name) . "', - `firstname` = '" . $db->escape($firstname) . "', - `company` = '" . $db->escape($company) . "', - `street` = '" . $db->escape($street) . "', - `zipcode` = '" . $db->escape($zipcode) . "', - `city` = '" . $db->escape($city) . "', - `phone` = '" . $db->escape($phone) . "', - `fax` = '" . $db->escape($fax) . "', - `email` = '" . $db->escape($email) . "', - `customernumber` = '" . $db->escape($customernumber) . "', - `def_language` = '" . $db->escape($def_language) . "', - `documentroot` = '" . $db->escape($documentroot) . "', - `guid` = '" . $db->escape($guid) . "', - `diskspace` = '" . $db->escape($diskspace) . "', - `traffic` = '" . $db->escape($traffic) . "', - `subdomains` = '" . $db->escape($subdomains) . "', - `emails` = '" . $db->escape($emails) . "', - `email_accounts` = '" . $db->escape($email_accounts) . "', - `email_forwarders` = '" . $db->escape($email_forwarders) . "', - `email_quota` = '" . $db->escape($email_quota) . "', - `ftps` = '" . $db->escape($ftps) . "', - `tickets` = '" . $db->escape($tickets) . "', - `mysqls` = '" . $db->escape($mysqls) . "', - `standardsubdomain` = '0', - `phpenabled` = '" . $db->escape($phpenabled) . "', - `imap` = '" . $db->escape($email_imap) . "', - `pop3` = '" . $db->escape($email_pop3) . "', - `aps_packages` = '" . (int)$number_of_aps_packages . "', - `perlenabled` = '" . $db->escape($perlenabled) . "', - `email_autoresponder` = '" . $db->escape($email_autoresponder) . "', - `sid` = '" . (int)$server_id . "'"); - + $result = $db->query("INSERT INTO `" . TABLE_PANEL_CUSTOMERS . "` (`adminid`, `loginname`, `password`, `name`, `firstname`, `company`, `street`, `zipcode`, `city`, `phone`, `fax`, `email`, `customernumber`, `def_language`, `documentroot`, `guid`, `diskspace`, `traffic`, `subdomains`, `emails`, `email_accounts`, `email_forwarders`, `email_quota`, `ftps`, `tickets`, `mysqls`, `standardsubdomain`, `phpenabled`, `imap`, `pop3`, `aps_packages`, `perlenabled`, `email_autoresponder`) VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($loginname) . "', '" . md5($password) . "', '" . $db->escape($name) . "', '" . $db->escape($firstname) . "', '" . $db->escape($company) . "', '" . $db->escape($street) . "', '" . $db->escape($zipcode) . "', '" . $db->escape($city) . "', '" . $db->escape($phone) . "', '" . $db->escape($fax) . "', '" . $db->escape($email) . "', '" . $db->escape($customernumber) . "','" . $db->escape($def_language) . "', '" . $db->escape($documentroot) . "', '" . $db->escape($guid) . "', '" . $db->escape($diskspace) . "', '" . $db->escape($traffic) . "', '" . $db->escape($subdomains) . "', '" . $db->escape($emails) . "', '" . $db->escape($email_accounts) . "', '" . $db->escape($email_forwarders) . "', '" . $db->escape($email_quota) . "', '" . $db->escape($ftps) . "', '" . $db->escape($tickets) . "', '" . $db->escape($mysqls) . "', '0', '" . $db->escape($phpenabled) . "', '" . $db->escape($email_imap) . "', '" . $db->escape($email_pop3) . "', '" . (int)$number_of_aps_packages . "', '" . $db->escape($perlenabled) . "', '" . $db->escape($email_autoresponder) . "')"); $customerid = $db->insert_id(); $admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` + 1"; @@ -696,7 +637,7 @@ if($page == 'customers' } $log->logAction(ADM_ACTION, LOG_INFO, "added user '" . $loginname . "'"); - inserttask('2', $loginname, $guid, $guid, $store_defaultindex, $server_id); + inserttask('2', $loginname, $guid, $guid, $store_defaultindex); // Add htpasswd for the webalizer stats @@ -721,7 +662,7 @@ if($page == 'customers' $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added webalizer htpasswd for user '" . $loginname . "'"); } - inserttask('1', $server_id); + inserttask('1'); $result = $db->query("INSERT INTO `" . TABLE_FTP_USERS . "` " . "(`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) " . "VALUES ('" . (int)$customerid . "', '" . $db->escape($loginname) . "', ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($documentroot) . "', 'y', '" . (int)$guid . "', '" . (int)$guid . "')"); $result = $db->query("INSERT INTO `" . TABLE_FTP_GROUPS . "` " . "(`customerid`, `groupname`, `gid`, `members`) " . "VALUES ('" . (int)$customerid . "', '" . $db->escape($loginname) . "', '" . $db->escape($guid) . "', '" . $db->escape($loginname) . "')"); $result = $db->query("INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES ('" . $db->escape($loginname) . "', 'user', '0', '0', '0', '0', '0', '0')"); @@ -757,7 +698,7 @@ if($page == 'customers' $domainid = $db->insert_id(); $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'' . (int)$domainid . '\' WHERE `customerid`=\'' . (int)$customerid . '\''); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added standardsubdomain for user '" . $loginname . "'"); - inserttask('1', $server_id); + inserttask('1'); } if($sendpassword == '1') @@ -844,16 +785,6 @@ if($page == 'customers' if($result['loginname'] != '') { - /* - * get server-id from customer (multiserver-support) - */ - $server_id = $result['sid']; - - /* - * @TODO enter server-id as select-condition where necessary - * 16.10.2010 d00p - */ - if(isset($_POST['send']) && $_POST['send'] == 'send') { @@ -870,12 +801,6 @@ if($page == 'customers' $def_language = validate($_POST['def_language'], 'default language'); $password = validate($_POST['new_customer_password'], 'new password'); $diskspace = intval_ressource($_POST['diskspace']); - /* - * get server-id fir customer (multiserver-support, default = 0) - * @TODO needs to be implemented in the interface, using 0 for now - * 16.10.2010 d00p - */ - //$server_id = intval_ressource($_POST['serverid']); if(isset($_POST['diskspace_ul'])) { @@ -1071,7 +996,7 @@ if($page == 'customers' $domainid = $db->insert_id(); $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'' . (int)$domainid . '\' WHERE `customerid`=\'' . (int)$result['customerid'] . '\''); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added standardsubdomain for user '" . $result['loginname'] . "'"); - inserttask('1', $server_id); + inserttask('1'); } if($createstdsubdomain == '0' @@ -1080,7 +1005,7 @@ if($page == 'customers' $db->query('DELETE FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `id`=\'' . (int)$result['standardsubdomain'] . '\''); $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'0\' WHERE `customerid`=\'' . (int)$result['customerid'] . '\''); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically deleted standardsubdomain for user '" . $result['loginname'] . "'"); - inserttask('1', $server_id); + inserttask('1'); } if($deactivated != '1') @@ -1101,7 +1026,7 @@ if($page == 'customers' if($phpenabled != $result['phpenabled'] || $perlenabled != $result['perlenabled']) { - inserttask('1', $server_id); + inserttask('1'); } if($deactivated != $result['deactivated']) @@ -1110,7 +1035,7 @@ if($page == 'customers' $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `login_enabled`='" . (($deactivated) ? 'N' : 'Y') . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `deactivated`='" . (int)$deactivated . "' WHERE `customerid`='" . (int)$id . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deactivated user '" . $result['loginname'] . "'"); - inserttask('1', $server_id); + inserttask('1'); } // Disable or enable POP3 Login for customers Mail Accounts diff --git a/admin_ipsandports.php b/admin_ipsandports.php index d90b55e2..d6e6f2a3 100644 --- a/admin_ipsandports.php +++ b/admin_ipsandports.php @@ -276,7 +276,7 @@ if($page == 'ipsandports' $ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile'); $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/'); $docroot = validate($_POST['docroot'], 'docroot'); - + if($listen_statement != '1') { $listen_statement = '0'; @@ -365,8 +365,8 @@ if($page == 'ipsandports' "); $log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'"); - inserttask('1', $server_id); - inserttask('4', $server_id); + inserttask('1'); + inserttask('4'); redirectTo($filename, Array('page' => $page, 's' => $s)); } } diff --git a/admin_phpsettings.php b/admin_phpsettings.php index a33c64a1..3d6606f1 100644 --- a/admin_phpsettings.php +++ b/admin_phpsettings.php @@ -88,13 +88,6 @@ if($page == 'overview') $phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); $mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', '')); $mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', '')); - /* - * get server-id for php-config (multiserver-support, default = 0) - * @TODO needs to be implemented in the interface, using 0 for now - * 16.10.2010 d00p - */ - //$server_id = intval_ressource($_POST['serverid']); - $server_id = 0; if(strlen($description) == 0 || strlen($description) > 50) @@ -102,17 +95,8 @@ if($page == 'overview') standard_error('descriptioninvalid'); } - $db->query("INSERT INTO - `" . TABLE_PANEL_PHPCONFIGS . "` - SET - `description` = '" . $db->escape($description) . "', - `binary` = '" . $db->escape($binary) . "', - `file_extensions` = '" . $db->escape($file_extensions) . "', - `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', - `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', - `phpsettings` = '" . $db->escape($phpsettings) . "', - `sid` = '" . (int)$server_id . "'"); - inserttask('1', $server_id); + $db->query("INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "'"); + inserttask('1'); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'"); redirectTo($filename, Array('page' => $page, 's' => $s)); } @@ -142,7 +126,7 @@ if($page == 'overview') { $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `phpsettingid` = 1 WHERE `phpsettingid` = " . (int)$id); $db->query("DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id); - inserttask('1', $result['sid']); + inserttask('1'); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'"); redirectTo($filename, Array('page' => $page, 's' => $s)); } @@ -165,16 +149,6 @@ if($page == 'overview') && $result['id'] == $id && (int)$userinfo['change_serversettings'] == 1) { - /* - * get server-id from php-config (multiserver-support) - */ - $server_id = $result['sid']; - - /* - * @TODO enter server-id as select-condition where necessary - * 16.10.2010 d00p - */ - if(isset($_POST['send']) && $_POST['send'] == 'send') { @@ -184,31 +158,15 @@ if($page == 'overview') $phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); $mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', '')); $mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', '')); - /* - * get server-id for php-config (multiserver-support, default = 0) - * @TODO needs to be implemented in the interface, using 0 for now - * 16.10.2010 d00p - */ - //$server_id = intval_ressource($_POST['serverid']); - + if(strlen($description) == 0 || strlen($description) > 50) { standard_error('descriptioninvalid'); } - $db->query("UPDATE - `" . TABLE_PANEL_PHPCONFIGS . "` - SET - `description` = '" . $db->escape($description) . "', - `binary` = '" . $db->escape($binary) . "', - `file_extensions` = '" . $db->escape($file_extensions) . "', - `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', - `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', - `phpsettings` = '" . $db->escape($phpsettings) . "', - `sid` = '" . (int)$server_id . "' - WHERE `id` = " . (int)$id); - inserttask('1', $server_id); + $db->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "' WHERE `id` = " . (int)$id); + inserttask('1'); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'"); redirectTo($filename, Array('page' => $page, 's' => $s)); } diff --git a/admin_updates.php b/admin_updates.php index 900fbb65..7cad6429 100644 --- a/admin_updates.php +++ b/admin_updates.php @@ -76,7 +76,7 @@ if($page == 'overview') eval("echo \"" . getTemplate("update/update_end") . "\";"); updateCounters(); - inserttask('1', -1); // -1 = all frox-clients + master (multiserver-mode) + inserttask('1'); @chmod('./lib/userdata.inc.php', 0440); $successful_update = true; diff --git a/customer_domains.php b/customer_domains.php index 2a9aefc2..8b6cbce7 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -195,8 +195,8 @@ elseif($page == 'domains') $log->logAction(USR_ACTION, LOG_INFO, "deleted subdomain '" . $idna_convert->decode($result['domain']) . "'"); $result = $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`-1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); - inserttask('1', (int)$userinfo['sid']); - inserttask('4', (int)$userinfo['sid']); + inserttask('1'); + inserttask('4'); redirectTo($filename, Array('page' => $page, 's' => $s)); } else @@ -345,8 +345,8 @@ elseif($page == 'domains') $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added subdomain '" . $completedomain . "'"); - inserttask('1', (int)$userinfo['sid']); - inserttask('4', (int)$userinfo['sid']); + inserttask('1'); + inserttask('4'); redirectTo($filename, Array('page' => $page, 's' => $s)); } } @@ -513,8 +513,8 @@ elseif($page == 'domains') { $log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'"); $result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot`='" . $db->escape($path) . "', `isemaildomain`='" . (int)$isemaildomain . "', `iswildcarddomain`='" . (int)$iswildcarddomain . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ",`openbasedir_path`='" . $db->escape($openbasedir_path) . "', `ssl_redirect`='" . $ssl_redirect . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); - inserttask('1', (int)$userinfo['sid']); - inserttask('4', (int)$userinfo['sid']); + inserttask('1'); + inserttask('4'); } redirectTo($filename, Array('page' => $page, 's' => $s)); diff --git a/customer_email.php b/customer_email.php index 24a7e107..adc0b8d2 100644 --- a/customer_email.php +++ b/customer_email.php @@ -187,7 +187,7 @@ elseif($page == 'emails') if(isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) { - inserttask('7', $userinfo['loginname'], $result['email_full'], (int)$userinfo['sid']); + inserttask('7', $userinfo['loginname'], $result['email_full']); } $db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); @@ -616,7 +616,7 @@ elseif($page == 'accounts') if(isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) { - inserttask('7', $userinfo['loginname'], $result['email_full'], (int)$userinfo['sid']); + inserttask('7', $userinfo['loginname'], $result['email_full']); } $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used` = `email_accounts_used` - 1, `email_quota_used` = `email_quota_used` - " . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); diff --git a/customer_extras.php b/customer_extras.php index 53d1e52e..a6b1d3f9 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -91,7 +91,7 @@ elseif($page == 'htpasswds') { $db->query("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='$id'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); - inserttask('1', (int)$userinfo['sid']); + inserttask('1'); redirectTo($filename, Array('page' => $page, 's' => $s)); } else @@ -154,7 +154,7 @@ elseif($page == 'htpasswds') { $db->query("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` (`customerid`, `username`, `password`, `path`, `authname`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($password) . "', '" . $db->escape($path) . "', '" . $db->escape($authname) . "')"); $log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'"); - inserttask('1', (int)$userinfo['sid']); + inserttask('1'); redirectTo($filename, Array('page' => $page, 's' => $s)); } } @@ -208,7 +208,7 @@ elseif($page == 'htpasswds') $db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET ".$pwd_sql.$auth_sql." WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); - inserttask('1', (int)$userinfo['sid']); + inserttask('1'); redirectTo($filename, Array('page' => $page, 's' => $s)); } } @@ -290,7 +290,7 @@ elseif($page == 'htaccess') { $db->query("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); - inserttask('1', (int)$userinfo['sid']); + inserttask('1'); redirectTo($filename, Array('page' => $page, 's' => $s)); } else @@ -347,7 +347,7 @@ elseif($page == 'htaccess') `options_cgi` = "'.$db->escape($options_cgi).'"'); $log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'"); - inserttask('1', (int)$userinfo['sid']); + inserttask('1'); redirectTo($filename, Array('page' => $page, 's' => $s)); } } @@ -395,7 +395,7 @@ elseif($page == 'htaccess') || ($error500path != $result['error500path']) || ($options_cgi != $result['options_cgi'])) { - inserttask('1', (int)$userinfo['sid']); + inserttask('1'); $db->query('UPDATE `' . TABLE_PANEL_HTACCESS . '` SET `options_indexes` = "' . $db->escape($option_indexes) . '", `error404path` = "' . $db->escape($error404path) . '", `error403path` = "' . $db->escape($error403path) . '", `error500path` = "' . $db->escape($error500path) . '", `options_cgi` = "' . $db->escape($options_cgi) . '" WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"'); $log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); } diff --git a/customer_ftp.php b/customer_ftp.php index 0c37c4a0..3736ce6e 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -119,7 +119,7 @@ elseif($page == 'accounts') if(isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) { - inserttask('8', $userinfo['loginname'], $result['homedir'], $userinfo['sid']); + inserttask('8', $userinfo['loginname'], $result['homedir']); } $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); @@ -201,7 +201,7 @@ elseif($page == 'accounts') $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'"); - inserttask(5, (int)$userinfo['sid']); + inserttask(5); if($sendinfomail == 1) { diff --git a/install/froxlor.sql b/install/froxlor.sql index 59a5d262..8ad2527e 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -45,7 +45,6 @@ CREATE TABLE `ftp_users` ( `down_count` int(15) NOT NULL default '0', `down_bytes` bigint(30) NOT NULL default '0', `customerid` int(11) NOT NULL default '0', - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), KEY `customerid` (`customerid`) @@ -104,7 +103,6 @@ CREATE TABLE `mail_virtual` ( `customerid` int(11) NOT NULL default '0', `popaccountid` int(11) NOT NULL default '0', `iscatchall` tinyint(1) unsigned NOT NULL default '0', - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`id`), KEY `email` (`email`) ) TYPE=MyISAM ; @@ -234,7 +232,6 @@ CREATE TABLE `panel_customers` ( `perlenabled` tinyint(1) NOT NULL default '0', `email_autoresponder` int(5) NOT NULL default '0', `email_autoresponder_used` int(5) NOT NULL default '0', - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`customerid`), UNIQUE KEY `loginname` (`loginname`) ) TYPE=MyISAM ; @@ -437,7 +434,6 @@ CREATE TABLE `panel_settings` ( `settinggroup` varchar(255) NOT NULL default '', `varname` varchar(255) NOT NULL default '', `value` text NOT NULL, - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`settingid`) ) TYPE=MyISAM ; @@ -466,7 +462,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload'); -INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn9'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn6'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900'); @@ -610,7 +606,6 @@ CREATE TABLE `panel_tasks` ( `id` int(11) unsigned NOT NULL auto_increment, `type` int(11) NOT NULL default '0', `data` text NOT NULL, - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM ; @@ -844,7 +839,6 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` ( `date` int(15) NOT NULL, `user` varchar(50) NOT NULL, `text` text NOT NULL, - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`logid`) ) ENGINE=MyISAM; @@ -893,7 +887,6 @@ CREATE TABLE `panel_phpconfigs` ( `mod_fcgid_starter` int(4) NOT NULL DEFAULT '-1', `mod_fcgid_maxrequests` int(4) NOT NULL DEFAULT '-1', `phpsettings` text NOT NULL, - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM; @@ -961,7 +954,6 @@ CREATE TABLE IF NOT EXISTS `aps_tasks` ( `ID` int(4) NOT NULL auto_increment, `InstanceID` int(4) NOT NULL, `Task` int(4) NOT NULL, - `sid` int(11) NOT NULL default '0', PRIMARY KEY (`ID`) ) ENGINE=MyISAM; @@ -1092,17 +1084,3 @@ CREATE TABLE IF NOT EXISTS `domain_redirect_codes` ( `did` int(11) unsigned NOT NULL, UNIQUE KEY `rc` (`rid`, `did`) ) ENGINE=MyISAM; - - -# -# Tabellenstruktur fuer Tabelle `froxlor_clients` -# - -DROP TABLE IF EXISTS `froxlor_clients`; -CREATE TABLE IF NOT EXISTS `froxlor_clients` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `desc` text NOT NULL default '', - `enabled` tinyint(1) DEFAULT '1', - PRIMARY KEY (`id`) -) ENGINE=MyISAM; diff --git a/install/install.php b/install/install.php index 435db9f1..97cda63e 100644 --- a/install/install.php +++ b/install/install.php @@ -255,17 +255,6 @@ function requirement_checks() status_message('green', 'OK'); } - // check for ssh2 (multiserver-mode) - status_message('begin', $lng['install']['phpssh2']); - if(!extension_loaded('ssh2')) - { - status_message('orange', $lng['install']['ssh2neededformultiserver']); - } - else - { - status_message('green', 'OK'); - } - if($_die) { ?> @@ -764,10 +753,8 @@ if(isset($_POST['installstep']) $userdata.= "\$sql_root[0]['caption']='Default';\n"; $userdata.= "\$sql_root[0]['host']='" . addcslashes($mysql_host, "'\\") . "';\n"; $userdata.= "\$sql_root[0]['user']='" . addcslashes($mysql_root_user, "'\\") . "';\n"; - $userdata.= "\$sql_root[0]['password']='" . addcslashes($mysql_root_pass, "'\\") . "';\n\n"; - $userdata.= "// Define our system id (multiserver support, default is '0')\n"; - $userdata.= "\$server_id = 0;\n"; - $userdata.= "?>\n"; + $userdata.= "\$sql_root[0]['password']='" . addcslashes($mysql_root_pass, "'\\") . "';\n"; + $userdata.= "?>"; //we test now if we can store the userdata.inc.php in ../lib diff --git a/install/lng/english.lng.php b/install/lng/english.lng.php index 0f9a6d3d..960816c3 100644 --- a/install/lng/english.lng.php +++ b/install/lng/english.lng.php @@ -98,8 +98,4 @@ $lng['install']['phpmagic_quotes_runtime'] = 'Checking whether magic_quotes_runt $lng['install']['active'] = 'no'; $lng['install']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off" in order to avoid strange behavior of Froxlor. Disabling it for now (this is only temporary, please fix our php.ini).'; -// ADDED IN FROXLOR 0.9.14-svn7 -$lng['install']['phpssh2'] = 'Testing if PHP ssh2-extension is installed...'; -$lng['install']['ssh2neededformultiserver'] = 'not found. If you plan to use the multiserver mode you have to recompile PHP with the ssh2-extenstion.' - ?> diff --git a/install/lng/german.lng.php b/install/lng/german.lng.php index 87c5305b..9f4f91d0 100644 --- a/install/lng/german.lng.php +++ b/install/lng/german.lng.php @@ -98,8 +98,4 @@ $lng['install']['phpmagic_quotes_runtime'] = 'Prüfe ob magic_quotes_runtime $lng['install']['active'] = 'nein'; $lng['install']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"), um merkwürdige Verhalten von Froxlor zu umgehen. Sie wurde deaktiviert (nur temporär, bitte php.ini anpassen).'; -// ADDED IN FROXLOR 0.9.14-svn7 -$lng['install']['phpssh2'] = 'Teste, ob die PHP ssh2-Erweiterung installiert ist...'; -$lng['install']['ssh2neededformultiserver'] = 'nicht gefunden. Falls Multiserver Modus genutzt werden soll, muss PHP mit der ssh2-Extenstion neu kompiliert werden.' - ?> diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index a45e7cb8..6f3d7cca 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -1168,132 +1168,3 @@ if(isFroxlorVersion('0.9.14-svn5')) updateToVersion('0.9.14-svn6'); } - -if(isFroxlorVersion('0.9.14-svn6')) -{ - showUpdateStep("Updating from 0.9.14-svn6 to 0.9.14-svn7", false); - - // remove deprecated realtime-feature - showUpdateStep("Removing realtime-feature (deprecated)"); - $db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'realtime_port';"); - lastStepStatus(0); - - // remove deprecated panel_navigation - showUpdateStep("Removing table `panel_navigation` (deprecated)"); - $db->query("DROP TABLE IF EXISTS `panel_navigation`;"); - lastStepStatus(0); - - // remove deprecated panel_cronscript - showUpdateStep("Removing table `panel_cronscript` (deprecated)"); - $db->query("DROP TABLE IF EXISTS `panel_cronscript`;"); - lastStepStatus(0); - - // make ticket-system ipv6 compatible - showUpdateStep("Altering IP field in panel_tickets (IPv6 compatibility)"); - $db->query("ALTER TABLE `" . TABLE_PANEL_TICKETS . "` MODIFY `ip` varchar(39) NOT NULL default '';"); - lastStepStatus(0); - - showUpdateStep("Preparing database tables for upcoming multi-server support"); - $db->query("ALTER TABLE `".TABLE_PANEL_SETTINGS."` ADD `sid` int(11) NOT NULL default '0' AFTER `value`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `sid` int(11) NOT NULL default '0' AFTER `email_autoresponder_used`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` ADD `sid` int(11) NOT NULL default '0' AFTER `iscatchall`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_FTP_USERS."` ADD `sid` int(11) NOT NULL default '0' AFTER `customerid`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_PANEL_TASKS."` ADD `sid` int(11) NOT NULL default '0' AFTER `data`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_APS_TASKS."` ADD `sid` int(11) NOT NULL default '0' AFTER `Task`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_PANEL_LOG."` ADD `sid` int(11) NOT NULL default '0' AFTER `text`;"); - - showUpdateStep("."); - $db->query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `sid` int(11) NOT NULL default '0' AFTER `phpsettings`;"); - lastStepStatus(0); - - showUpdateStep("Adding new table `".TABLE_FROXLOR_CLIENTS."`"); - $db->query("DROP TABLE IF EXISTS `".TABLE_FROXLOR_CLIENTS."`"); - $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_FROXLOR_CLIENTS."` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `ip` varchar(39) NOT NULL default '', - `enabled` tinyint(1) DEFAULT '1', - PRIMARY KEY (`id`) - ) ENGINE=MyISAM;"); - lastStepStatus(0); - - // add $server_id to userdata.inc.php for upcoming multi-server-support - showUpdateStep("Adding server-id setting for upcoming multi-server support to userdata.inc.php"); - $mypath = dirname(dirname(dirname(dirname(dirname(__FILE__))))); // froxlor-rootdir - $userdatafile = makeCorrectFile($mypath.'/lib/userdata.inc.php'); - $userdata = @file_get_contents($userdatafile); - $newcontent = ''; - if($userdata !== false) - { - $ud = explode("\n", $userdata); - // add server_id lines at the end - $lastidx = count($ud) -1; - while($ud[$lastidx] != "?>") - { - $lastidx--; - } - $ud[$lastidx] = "\n"; - $ud[$lastidx++] = "// Define our system id (multiserver support, default is '0')\n"; - $ud[$lastidx++] = "\$server_id = 0;\n"; - $ud[$lastidx++] = "?>\n"; - - @copy($userdatafile, $userdatafile.'.bak'); - @unlink($userdatafile); - $writesuccess = @fopen($userdatafile, 'w'); - - if($writesuccess !== false) - { - @fwrite($writesuccess, implode("\n", $ud)); - @fclose($writesucsess); - @unlink($userdatafile.'.bak'); - lastStepStatus(0); - } - else - { - @copy($userdatafile.'.bak', $userdatafile); - @unlink($userdatafile.'.bak'); - lastStepStatus(2, 'Failed to append server-id to userdata.inc.php file. Please put \$server_id = 0; to your userdata.inc.php file manually.'); - } - } - else - { - lastStepStatus(2, 'Failed to read userdata.inc.php file. Please put \$server_id = 0; to your userdata.inc.php file manually.'); - } - - updateToVersion('0.9.14-svn7'); -} - -if(isFroxlorVersion('0.9.14-svn7')) -{ - showUpdateStep("Updating from 0.9.14-svn7 to 0.9.14-svn8", false); - - showUpdateStep("Removing deprecated legacy-cronjob from database"); - $db->query("DELETE FROM `".TABLE_PANEL_CRONRUNS."` WHERE `cronfile` ='cron_legacy.php';"); - lastStepStatus(0); - - updateToVersion('0.9.14-svn8'); -} - -if(isFroxlorVersion('0.9.14-svn8')) -{ - showUpdateStep("Updating from 0.9.14-svn8 to 0.9.14-svn9", false); - - showUpdateStep("Updating table 'froxlor_clients'"); - $db->query("ALTER TABLE `".TABLE_FROXLOR_CLIENTS."` DROP `ip`;"); - $db->query("ALTER TABLE `".TABLE_FROXLOR_CLIENTS."` ADD `desc` text NOT NULL default '' AFTER `id`;"); - lastStepStatus(0); - - updateToVersion('0.9.14-svn9'); -} diff --git a/install/updates/preconfig.php b/install/updates/preconfig.php index 8db6380b..6d38ec76 100644 --- a/install/updates/preconfig.php +++ b/install/updates/preconfig.php @@ -43,3 +43,20 @@ function getPreConfig($current_version) return ''; } } + +function versionInUpdate($current_version, $version_to_check) +{ + if (!isFroxlor()) { + return true; + } + $pos_a = strpos($current_version, '-svn'); + $pos_b = strpos($version_to_check, '-svn'); + // if we compare svn-versions, we have to add -svn0 to the version + // to compare it correctly + if($pos_a === false && $pos_b !== false) + { + $current_version.= '-svn9999'; + } + + return version_compare($current_version, $version_to_check, '<'); +} diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index c519b1bb..c17b7d5e 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -343,12 +343,4 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) $question.= makeyesno('update_allow_domain_login', '1', '0', '0'); eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); } - - if(versionInUpdate($current_version, '0.9.14-svn7')) - { - $has_preconfig = true; - $description = 'This update removes the unsupported real-time option. Additionally the deprecated tables for navigation and cronscripts are removed, any modules using these tables need to be updated to the new structure!'; - $question = ''; - eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); - } } diff --git a/lib/functions/database/function.correctMysqlUsers.php b/lib/functions/database/function.correctMysqlUsers.php index 2922c283..3e3b05bc 100644 --- a/lib/functions/database/function.correctMysqlUsers.php +++ b/lib/functions/database/function.correctMysqlUsers.php @@ -17,18 +17,8 @@ * @version $Id$ */ -function correctMysqlUsers($mysql_access_host_array, $server_id = 0) +function correctMysqlUsers($mysql_access_host_array) { - /** - * for multiserver-clients - * this has to be done in - * a different way - */ - if($server_id > 0) { - correctMysqlUsersRemote($mysql_access_host_array, $server_id); - return; - } - global $db, $settings, $sql, $sql_root; foreach($sql_root as $mysql_server => $mysql_server_details) @@ -99,17 +89,3 @@ function correctMysqlUsers($mysql_access_host_array, $server_id = 0) unset($db_root); } } - -/** - * @TODO finish me - * @param array $mysql_access_host_array list of ips/hostnames of the mysql-server - * @param int $server_id id of the multiserver-client - * - * @return null - */ -function correctMysqlUsersRemote($mysql_access_host_array, $server_id = 0) -{ - /* if($server_id == 0) */ - return; - -} diff --git a/lib/functions/formfields/function.buildFormEx.php b/lib/functions/formfields/function.buildFormEx.php index 17c9f6d3..f898a440 100644 --- a/lib/functions/formfields/function.buildFormEx.php +++ b/lib/functions/formfields/function.buildFormEx.php @@ -15,7 +15,7 @@ * @version $Id $ */ -function buildFormEx($form, $part = '', $server_id = 0) +function buildFormEx($form, $part = '') { $fields = ''; @@ -28,7 +28,7 @@ function buildFormEx($form, $part = '', $server_id = 0) { if(isset($groupdetails['title']) && $groupdetails['title'] != '') { - $fields .= getFormOverviewGroupOutput($groupname, $groupdetails, $server_id); + $fields .= getFormOverviewGroupOutput($groupname, $groupdetails); } } // only show one section @@ -38,7 +38,7 @@ function buildFormEx($form, $part = '', $server_id = 0) { $fields .= getFormGroupOutput($groupname, $groupdetails); } - + if(validateFieldDefinition($groupdetails)) { // Prefetch form fields @@ -47,7 +47,7 @@ function buildFormEx($form, $part = '', $server_id = 0) $groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails)); $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname]; } - + // Collect form field output foreach($groupdetails['fields'] as $fieldname => $fielddetails) { diff --git a/lib/functions/formfields/function.getFormGroupOutput.php b/lib/functions/formfields/function.getFormGroupOutput.php index 82dd3fe2..782784ad 100644 --- a/lib/functions/formfields/function.getFormGroupOutput.php +++ b/lib/functions/formfields/function.getFormGroupOutput.php @@ -24,7 +24,7 @@ function getFormGroupOutput($groupname, $groupdetails) return $group; } -function getFormOverviewGroupOutput($groupname, $groupdetails, $server_id = 0) +function getFormOverviewGroupOutput($groupname, $groupdetails) { global $lng, $settings, $filename, $s; @@ -63,34 +63,14 @@ function getFormOverviewGroupOutput($groupname, $groupdetails, $server_id = 0) } else { - if(isset($fielddetails['disabled']) && $fielddetails['disabled'] == true) - { - $d = true; - $option.=''; - } else { - $d = false; - } $option.= $lng['admin']['activated'].': '; - $option.= makeyesno($fieldname, '1', '0', $settings[$fielddetails['settinggroup']][$fielddetails['varname']], $d); - if($d) { - $option.=''; - } + $option.= makeyesno($fieldname, '1', '0', $settings[$fielddetails['settinggroup']][$fielddetails['varname']]); $activated = (int)$settings[$fielddetails['settinggroup']][$fielddetails['varname']]; } } } } - // if the server_id is > 0 then - // this is a client-settings page - // and we need another template - if($server_id > 0) - { - eval("\$group = \"" . getTemplate("froxlorclients/froxlorclient_settingsoverviewgroup") . "\";"); - } - else - { - eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";"); - } + eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";"); return $group; } diff --git a/lib/functions/formfields/function.processForm.php b/lib/functions/formfields/function.processForm.php index 5a392330..ae4cbed0 100644 --- a/lib/functions/formfields/function.processForm.php +++ b/lib/functions/formfields/function.processForm.php @@ -144,7 +144,7 @@ function processForm(&$form, &$input, $url_params = array()) } } -function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_all, $settings_part, $only_enabledisable, $server_id = 0) +function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_all, $settings_part, $only_enabledisable) { if(validateFormDefinition($form)) { @@ -287,7 +287,7 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_ ) { if(isset($changed_fields[$fieldname])) { - if(($saved_field = saveFormField($fieldname, $fielddetails, manipulateFormFieldData($fieldname, $fielddetails, $changed_fields[$fieldname]), $server_id)) !== false) + if(($saved_field = saveFormField($fieldname, $fielddetails, manipulateFormFieldData($fieldname, $fielddetails, $changed_fields[$fieldname]))) !== false) { $saved_fields = array_merge($saved_fields, $saved_field); } diff --git a/lib/functions/formfields/function.saveFormField.php b/lib/functions/formfields/function.saveFormField.php index 470645aa..79886b0b 100644 --- a/lib/functions/formfields/function.saveFormField.php +++ b/lib/functions/formfields/function.saveFormField.php @@ -17,12 +17,12 @@ * @version $Id$ */ -function saveFormField($fieldname, $fielddata, $newfieldvalue, $server_id = 0) +function saveFormField($fieldname, $fielddata, $newfieldvalue) { $returnvalue = ''; if(is_array($fielddata) && isset($fielddata['save_method']) && $fielddata['save_method'] != '' && function_exists($fielddata['save_method'])) { - $returnvalue = call_user_func($fielddata['save_method'], $fieldname, $fielddata, $newfieldvalue, $server_id); + $returnvalue = call_user_func($fielddata['save_method'], $fieldname, $fielddata, $newfieldvalue); } elseif(is_array($fielddata) && !isset($fielddata['save_method'])) { diff --git a/lib/functions/froxlor/function.inserttask.php b/lib/functions/froxlor/function.inserttask.php index 8d650632..c165848c 100644 --- a/lib/functions/froxlor/function.inserttask.php +++ b/lib/functions/froxlor/function.inserttask.php @@ -19,53 +19,17 @@ /** * Inserts a task into the PANEL_TASKS-Table - * - * @author Florian Lippert (2003-2009) - * @author Froxlor team (2010-) + * + * @param int Type of task + * @param string Parameter 1 + * @param string Parameter 2 + * @param string Parameter 3 + * @author Florian Lippert */ -function inserttask() +function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '') { global $db, $settings; - - $numargs = func_num_args(); - - if($numargs <= 0) { - // no arguments given, exiting - return; - } - - // type will always be the first argument - $type = func_get_arg(0); - - // server-id will always be the last argument - // (if not set, use id of master (0) - $server_id = ($numargs-1 <= 0) ? 0 : func_get_arg($numargs-1); - - // get the rest of the params - $taskparams = array(); - for($x=1;$x<$numargs-1;$x++) - { - $taskparams[] = func_get_arg($x); - } - - // if server_id = -1 then add this task for EVERY froxlor-client - if($server_id == -1) - { - $numclients = froxlorclient::getFroxlorClients($db); - if(is_array($numclients) - && count($numclients) > 0 - ) { - foreach($numclients as $froxclient_id) - { - inserttask($type, implode(', ', $taskparams), $froxclient_id); - } - } - - // also for the master - inserttask($type, implode(', ', $taskparams), 0); - return; - } if($type == '1' || $type == '3' @@ -73,48 +37,96 @@ function inserttask() || $type == '5') { $db->query('DELETE FROM `' . TABLE_PANEL_TASKS . '` WHERE `type`="' . $type . '"'); - $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `sid`) VALUES ("' . $type . '", "'.$server_id.'")'); + $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`) VALUES ("' . $type . '")'); + $doupdate = true; } elseif($type == '2' - && $taskparams[0] != '' - && $taskparams[1] != '' - && $taskparams[2] != '' - && $taskparams[3] != '') + && $param1 != '' + && $param2 != '' + && $param3 != '' + && $param4 != '') { $data = Array(); - $data['loginname'] = $taskparams[0]; - $data['uid'] = $taskparams[1]; - $data['gid'] = $taskparams[2]; - $data['store_defaultindex'] = $taskparams[3]; + $data['loginname'] = $param1; + $data['uid'] = $param2; + $data['gid'] = $param3; + $data['store_defaultindex'] = $param4; $data = serialize($data); - $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("2", "' . $db->escape($data) . '", "'.$server_id.'")'); + $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("2", "' . $db->escape($data) . '")'); + $doupdate = true; } elseif($type == '6' - && $taskparams[0] != '') + && $param1 != '') { $data = Array(); - $data['loginname'] = $taskparams[0]; + $data['loginname'] = $param1; $data = serialize($data); - $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("6", "' . $db->escape($data) . '", "'.$server_id.'")'); + $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("6", "' . $db->escape($data) . '")'); + $doupdate = true; } elseif($type == '7' - && $taskparams[0] != '' - && $taskparams[1] != '') + && $param1 != '' + && $param2 != '') { $data = Array(); - $data['loginname'] = $taskparams[0]; - $data['email'] = $taskparams[1]; + $data['loginname'] = $param1; + $data['email'] = $param2; $data = serialize($data); - $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("7", "' . $db->escape($data) . '", "'.$server_id.'")'); + $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("7", "' . $db->escape($data) . '")'); + $doupdate = true; } elseif($type == '8' - && $taskparams[0] != '' - && $taskparams[1] != '') + && $param1 != '' + && $param2 != '') { $data = Array(); - $data['loginname'] = $taskparams[0]; - $data['homedir'] = $taskparams[1]; + $data['loginname'] = $param1; + $data['homedir'] = $param2; $data = serialize($data); - $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("8", "' . $db->escape($data) . '", "'.$server_id.'")'); + $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("8", "' . $db->escape($data) . '")'); + $doupdate = true; + } + + if($doupdate === true + && (int)$settings['system']['realtime_port'] !== 0 + && function_exists('socket_create')) + { + $timeout = 15; + //$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + + if($socket !== false) + { + // create the request packet + $packet = chr(0) . chr(1) . 'RUN' . chr(0); + // UDP is connectionless, so we just send on it. + //@socket_sendto($socket, $packet, strlen($packet), 0x100, '127.0.0.1', (int)$settings['system']['realtime_port']); + + /* + * this is for TCP-Connections + */ + $time = time(); + + while(!@socket_connect($socket, '127.0.0.1', (int)$settings['system']['realtime_port'])) + { + $err = socket_last_error($socket); + + if($err == 115 + || $err == 114) + { + if((time() - $time) >= $timeout) + { + break; + } + + sleep(1); + continue; + } + } + /** + * close socket + */ + @socket_close($socket); + } } } diff --git a/lib/functions/settings/function.loadSettings.php b/lib/functions/settings/function.loadSettings.php index 0fd363a6..d3c4db96 100644 --- a/lib/functions/settings/function.loadSettings.php +++ b/lib/functions/settings/function.loadSettings.php @@ -17,16 +17,8 @@ * @version $Id$ */ -function loadSettings(&$settings_data, $db, $server_id = 0) +function loadSettings(&$settings_data, $db) { - // to check whether we're on a recent - // Froxlor installation which supports - // multiserver-settings, we have to read - // the version from the database - $_dbversion = ''; - $_dv = $db->query_first("SELECT `value` FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'version';"); - $_dbversion = $_dv['value']; - $settings = array(); if(is_array($settings_data) && isset($settings_data['groups']) && is_array($settings_data['groups'])) @@ -39,49 +31,11 @@ function loadSettings(&$settings_data, $db, $server_id = 0) { if(isset($field_details['settinggroup']) && isset($field_details['varname']) && isset($field_details['default'])) { - $sql_query = 'SELECT - `settinggroup`, `varname`, `value` - FROM - `' . TABLE_PANEL_SETTINGS . '` - WHERE - `settinggroup` = \'' . $db->escape($field_details['settinggroup']) . '\' - AND - `varname` = \'' . $db->escape($field_details['varname']) . '\' '; - - // since 0.9.14-svn7 we have $server_id for multi-server-support - // but versions before 0.9.14-svn7 don't have the `sid` field - // in panel_settings, so only append the condition if we're on - // 0.9.14-svn7 or higher - if(compareFroxlorVersion('0.9.14-svn7', $_dbversion)) - { - $sql_query_sid = 'AND `sid` = \''. (int)$server_id . '\' '; - } else { - $sql_query_sid = ''; - } - - $row = $db->query_first($sql_query.$sql_query_sid); + $row = $db->query_first('SELECT `settinggroup`, `varname`, `value` FROM `' . TABLE_PANEL_SETTINGS . '` WHERE `settinggroup` = \'' . $db->escape($field_details['settinggroup']) . '\' AND `varname` = \'' . $db->escape($field_details['varname']) . '\' '); if(!empty($row)) { $varvalue = $row['value']; } - elseif($server_id > 0) - { - // if we're a client (server_id > 0) - // and a setting is not found or not - // needed for clients, we get it from - // the master (server_id = 0) - $sql_query_sid = 'AND `sid` = \'0\' '; - $row = $db->query_first($sql_query.$sql_query_sid); - if(!empty($row)) - { - $varvalue = $row['value']; - } - else - { - // default to array-default-value - $varvalue = $field_details['default']; - } - } else { $varvalue = $field_details['default']; diff --git a/lib/functions/settings/function.saveSetting.php b/lib/functions/settings/function.saveSetting.php index b5602db3..57290599 100644 --- a/lib/functions/settings/function.saveSetting.php +++ b/lib/functions/settings/function.saveSetting.php @@ -17,20 +17,11 @@ * @version $Id$ */ -function saveSetting($settinggroup, $varname, $newvalue, $server_id = 0) +function saveSetting($settinggroup, $varname, $newvalue) { global $db; - - $query = 'UPDATE - `' . TABLE_PANEL_SETTINGS . '` - SET - `value` = \'' . $db->escape($newvalue) . '\' - WHERE - `settinggroup` = \'' . $db->escape($settinggroup) . '\' - AND - `varname`=\'' . $db->escape($varname) . '\' - AND - `sid`=\''. (int)$server_id . '\' '; - + $query = 'UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = \'' . $db->escape($newvalue) . '\' WHERE `settinggroup` = \'' . $db->escape($settinggroup) . '\' AND `varname`=\'' . $db->escape($varname) . '\''; return $db->query($query); } + +?> diff --git a/lib/functions/settings/function.storeSettingField.php b/lib/functions/settings/function.storeSettingField.php index 71114ab2..fdb7e5ce 100644 --- a/lib/functions/settings/function.storeSettingField.php +++ b/lib/functions/settings/function.storeSettingField.php @@ -17,11 +17,11 @@ * @version $Id$ */ -function storeSettingField($fieldname, $fielddata, $newfieldvalue, $server_id = 0) +function storeSettingField($fieldname, $fielddata, $newfieldvalue) { if(is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] != '' && isset($fielddata['varname']) && $fielddata['varname'] != '') { - if(saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue, $server_id) != false) + if(saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue) != false) { /* * when fielddata[cronmodule] is set, this means enable/disable a cronjob @@ -38,7 +38,7 @@ function storeSettingField($fieldname, $fielddata, $newfieldvalue, $server_id = { if((int)$fielddata['dependency']['onlyif'] == (int)$newfieldvalue) { - storeSettingField($fielddata['dependency']['fieldname'], $fielddata['dependency']['fielddata'], $newfieldvalue, $server_id); + storeSettingField($fielddata['dependency']['fieldname'], $fielddata['dependency']['fielddata'], $newfieldvalue); } } diff --git a/lib/functions/settings/function.storeSettingHostname.php b/lib/functions/settings/function.storeSettingHostname.php index f35ea802..d338caf3 100644 --- a/lib/functions/settings/function.storeSettingHostname.php +++ b/lib/functions/settings/function.storeSettingHostname.php @@ -17,16 +17,16 @@ * @version $Id$ */ -function storeSettingHostname($fieldname, $fielddata, $newfieldvalue, $server_id = 0) +function storeSettingHostname($fieldname, $fielddata, $newfieldvalue) { - $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue, $server_id ); + $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue); if($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'hostname') { global $db, $idna_convert; $newfieldvalue = $idna_convert->encode($newfieldvalue); - $customerstddomains_result = $db->query('SELECT `standardsubdomain` FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `standardsubdomain` <> \'0\' and `sid` = "'.$server_id.'"'); + $customerstddomains_result = $db->query('SELECT `standardsubdomain` FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `standardsubdomain` <> \'0\''); $ids = array(); while($customerstddomains_row = $db->fetch_array($customerstddomains_result)) @@ -36,15 +36,8 @@ function storeSettingHostname($fieldname, $fielddata, $newfieldvalue, $server_id if(count($ids) > 0) { - if($server_id > 0) - { - $client = froxlorclient::getInstance(null, $db, $server_id); - $syshostname = $client->getSetting('system', 'hostname'); - } else { - $syshostname = getSetting('system', 'hostname'); - } - $db->query('UPDATE `' . TABLE_PANEL_DOMAINS . '` SET `domain` = REPLACE(`domain`, \'' . $db->escape($syshostname) . '\', \'' . $db->escape($newfieldvalue) . '\') WHERE `id` IN (\'' . implode('\',\'', $ids) . '\') AND `sid` = "'.$server_id.'"'); - inserttask('1', $server_id); + $db->query('UPDATE `' . TABLE_PANEL_DOMAINS . '` SET `domain` = REPLACE(`domain`, \'' . $db->escape(getSetting('system', 'hostname')) . '\', \'' . $db->escape($newfieldvalue) . '\') WHERE `id` IN (\'' . implode('\',\'', $ids) . '\')'); + inserttask('1'); } } diff --git a/lib/functions/settings/function.storeSettingIpAddress.php b/lib/functions/settings/function.storeSettingIpAddress.php index 90e977e3..5bec530e 100644 --- a/lib/functions/settings/function.storeSettingIpAddress.php +++ b/lib/functions/settings/function.storeSettingIpAddress.php @@ -17,20 +17,13 @@ * @version $Id$ */ -function storeSettingIpAddress($fieldname, $fielddata, $newfieldvalue, $server_id = 0) +function storeSettingIpAddress($fieldname, $fielddata, $newfieldvalue) { - $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue, $server_id); + $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue); if($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'ipaddress') { - if($server_id > 0) - { - $client = froxlorclient::getInstance(null, $db, $server_id); - $mysqlhosts = $client->getSetting('system', 'mysql_access_host'); - } else { - $mysqlhosts = getSetting('system', 'mysql_access_host'); - } - $mysql_access_host_array = array_map('trim', explode(',', $mysqlhosts)); + $mysql_access_host_array = array_map('trim', explode(',', getSetting('system', 'mysql_access_host'))); $mysql_access_host_array[] = $newfieldvalue; $mysql_access_host_array = array_unique(array_trim($mysql_access_host_array)); $mysql_access_host = implode(',', $mysql_access_host_array); diff --git a/lib/functions/settings/function.storeSettingMysqlAccessHost.php b/lib/functions/settings/function.storeSettingMysqlAccessHost.php index 236c972e..b7749b6e 100644 --- a/lib/functions/settings/function.storeSettingMysqlAccessHost.php +++ b/lib/functions/settings/function.storeSettingMysqlAccessHost.php @@ -17,9 +17,9 @@ * @version $Id$ */ -function storeSettingMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $server_id = 0) +function storeSettingMysqlAccessHost($fieldname, $fielddata, $newfieldvalue) { - $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue, $server_id); + $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue); if($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'mysql_access_host') { @@ -39,7 +39,7 @@ function storeSettingMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $se $mysql_access_host_array = array_unique(array_trim($mysql_access_host_array)); $newfieldvalue = implode(',', $mysql_access_host_array); - correctMysqlUsers($mysql_access_host_array, $server_id); + correctMysqlUsers($mysql_access_host_array); } return $returnvalue; diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 00bf7a68..4e93fc7a 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -52,7 +52,6 @@ define('TABLE_APS_TEMP_SETTINGS', 'aps_temp_settings'); define('TABLE_PANEL_CRONRUNS', 'cronjobs_run'); define('TABLE_PANEL_REDIRECTCODES', 'redirect_codes'); define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes'); -define('TABLE_FROXLOR_CLIENTS', 'froxlor_clients'); // APS constants @@ -72,7 +71,7 @@ define('PACKAGE_ENABLED', 2); // VERSION INFO -$version = '0.9.14-svn9'; +$version = '0.9.14-svn6'; $dbversion = '2'; $branding = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index 47f7513d..593761f6 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1511,33 +1511,4 @@ $lng['admin']['ipsandports']['docroot']['description'] = 'You can define a custo // ADDED IN FROXLOR 0.9.14-svn6 $lng['serversettings']['login_domain_login'] = 'Allow login with domains'; -// ADDED IN FROXLOR 0.9.14-svn7 -$lng['admin']['multiserver'] = 'Multiserver settings'; -$lng['multiserver']['enabled']['title'] = 'Enable multiserver mode'; -$lng['multiserver']['enabled']['description'] = '@TODO'; - -// ADDED IN FROXLOR 0.9.14-svn9 -$lng['mysql']['database_edit'] = 'Edit database'; -$lng['admin']['froxlorclients']['add'] = 'Create new Froxlor-client'; -$lng['admin']['froxlorclients']['edit'] = 'Edit Froxlor-client'; -$lng['admin']['froxlorclients']['longdesc_add'] = '@TODO a long description on how the multiserver-client thing works'; -$lng['admin']['froxlorclients']['client'] = 'Froxlor client'; -$lng['admin']['froxlorclients']['name'] = 'Client name'; -$lng['admin']['froxlorclients']['desc'] = 'Client description'; -$lng['admin']['froxlorclients']['enabled'] = 'Client enabled?'; -$lng['admin']['froxlorclients']['settings'] = 'settings'; -$lng['admin']['froxlorclients']['deploy'] = 'deploy'; -$lng['menue']['multiserver']['clients'] = 'Multiserver clients'; -$lng['admin']['froxlorclient'] = 'Multiserver client settings'; -$lng['admin']['froxlorclient_settings'] = 'Froxlor client settings:'; -$lng['froxlorclient']['ipaddress'] = 'Client IP'; -$lng['froxlorclient']['hostname'] = 'Client hostname'; -$lng['froxlorclient']['deploy_mode'] = 'Deploy mode'; -$lng['froxlorclient']['ssh_port'] = 'SSH port'; -$lng['froxlorclient']['ssh_user'] = 'SSH user'; -$lng['froxlorclient']['ssh_passphrase'] = 'SSH passphrase'; -$lng['froxlorclient']['ssh_pubkey'] = 'SSH public key'; -$lng['froxlorclient']['ssh_privkey'] = 'SSH private key'; -$lng['froxlorclient']['install_destination'] = 'Froxlor client data destination'; - ?> diff --git a/lng/german.lng.php b/lng/german.lng.php index fb35c03e..e6af5cb3 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1494,11 +1494,4 @@ $lng['admin']['ipsandports']['docroot']['description'] = 'Hier kann ein benutzer // ADDED IN FROXLOR 0.9.14-svn6 $lng['serversettings']['login_domain_login'] = 'Erlaube Anmeldung mit Domains'; -// ADDED IN FROXLOR 0.9.14-svn7 -$lng['admin']['multiserver'] = 'Multiserver Einstellungen'; -$lng['multiserver']['enabled']['title'] = 'Aktiviere den Multiserver Modus'; - -// ADDED IN FROXLOR 0.9.14-svn9 -$lng['mysql']['database_edit'] = 'Datenbank bearbeiten'; - ?> diff --git a/scripts/jobs/cron_tasks.php b/scripts/jobs/cron_tasks.php index 2a568168..8a712a81 100644 --- a/scripts/jobs/cron_tasks.php +++ b/scripts/jobs/cron_tasks.php @@ -25,10 +25,6 @@ require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.10.apache require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.15.apache_fcgid.php')); require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.20.lighttpd.php')); require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.25.lighttpd_fcgid.php')); -// only include if multiserver is enabled -if($settings['multiserver']['enabled']) { - require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.multiserver.client_deploy.php')); -} /** * LOOK INTO TASKS TABLE TO SEE IF THERE ARE ANY UNDONE JOBS @@ -36,14 +32,7 @@ if($settings['multiserver']['enabled']) { fwrite($debugHandler, ' cron_tasks: Searching for tasks to do' . "\n"); $cronlog->logAction(CRON_ACTION, LOG_INFO, "Searching for tasks to do"); -$server_id = getServerId(); -$result_tasks = $db->query("SELECT - `id`, `type`, `data` -FROM - `" . TABLE_PANEL_TASKS . "` -WHERE - `sid` = '".$server_id."' -ORDER BY `id` ASC"); +$result_tasks = $db->query("SELECT `id`, `type`, `data` FROM `" . TABLE_PANEL_TASKS . "` ORDER BY `id` ASC"); $resultIDs = array(); while($row = $db->fetch_array($result_tasks)) @@ -379,36 +368,6 @@ while($row = $db->fetch_array($result_tasks)) } } } - - /** - * TYPE=9 -> deploy a Froxlor multiserver client to its destination - */ - elseif ($row['type'] == '9') - { - fwrite($debugHandler, ' cron_tasks: Task9 started - deploy a Froxlor multiserver client' . "\n"); - $cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task9 started - deploy a Froxlor multiserver client'); - - if(is_array($row['data'])) - { - if(isset($row['data']['serverid'])) - { - /* - * get froxlor-client-object - */ - $client = froxlorclient::getInstance(null, $db, (int)$row['data']['serverid']); - /* - * create new deployer-object - */ - $deployer = new client_deployer($client); - /* - * deploy - * - * @TODO handle Exceptions - */ - $deployer->Deploy(); - } - } - } } if($db->num_rows($result_tasks) != 0)