diff options
Diffstat (limited to 'syscp/patches/mysql-ftp-patch/syscp-1.2.13-mysqli-ftpi.patch')
-rw-r--r-- | syscp/patches/mysql-ftp-patch/syscp-1.2.13-mysqli-ftpi.patch | 712 |
1 files changed, 0 insertions, 712 deletions
diff --git a/syscp/patches/mysql-ftp-patch/syscp-1.2.13-mysqli-ftpi.patch b/syscp/patches/mysql-ftp-patch/syscp-1.2.13-mysqli-ftpi.patch deleted file mode 100644 index eeaf12e..0000000 --- a/syscp/patches/mysql-ftp-patch/syscp-1.2.13-mysqli-ftpi.patch +++ /dev/null @@ -1,712 +0,0 @@ -diff -Nru syscp-gentoo-comp/admin_customers.php syscp-mysql-ftp-imp/admin_customers.php ---- syscp-gentoo-comp/admin_customers.php 2006-03-26 00:52:39.000000000 +0100 -+++ syscp-mysql-ftp-imp/admin_customers.php 2006-03-26 00:54:43.000000000 +0100 -@@ -158,20 +158,24 @@ - if(isset($_POST['send']) && $_POST['send']=='send') - { - $databases=$db->query("SELECT * FROM ".TABLE_PANEL_DATABASES." WHERE customerid='$id'"); -+ $databasesusers=$db->query("SELECT * FROM ".TABLE_PANEL_DATABASES_USERS." WHERE customerid='$id'"); - $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); - unset($db_root->password); - while($row_database=$db->fetch_array($databases)) - { -- $db_root->query( 'REVOKE ALL PRIVILEGES ON * . * FROM `' . $row_database['databasename'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -- $db_root->query( 'REVOKE ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $row_database['databasename'] ) . '` . * FROM `' . $row_database['databasename'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -- $db_root->query( 'DELETE FROM `mysql`.`user` WHERE `User` = "' . $row_database['databasename'] . '" AND `Host` = "' . $settings['system']['mysql_access_host'] . '"' ); - $db_root->query( 'DROP DATABASE IF EXISTS `' . $row_database['databasename'] . '`' ); - } -+ while($row_databaseuser=$db->fetch_array($databasesusers)) -+ { -+ $db_root->query( 'REVOKE ALL PRIVILEGES ON * . * FROM `' . $row_databaseuser['databaseuser'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -+ $db_root->query( 'DELETE FROM `mysql`.`user` WHERE `User` = "' . $row_databaseuser['databaseuser'] . '" AND `Host` = "' . $settings['system']['mysql_access_host'] . '"' ); -+ } - $db_root->query('FLUSH PRIVILEGES;'); - $db_root->close(); - - $db->query("DELETE FROM `".TABLE_PANEL_CUSTOMERS."` WHERE `customerid`='$id'"); - $db->query("DELETE FROM `".TABLE_PANEL_DATABASES."` WHERE `customerid`='$id'"); -+ $db->query("DELETE FROM `".TABLE_PANEL_DATABASES_USERS."` WHERE `customerid`='$id'"); - $db->query("DELETE FROM `".TABLE_PANEL_DOMAINS."` WHERE `customerid`='$id'"); - $domains_deleted = $db->affected_rows(); - $db->query("DELETE FROM `".TABLE_PANEL_HTPASSWDS."` WHERE `customerid`='$id'"); -diff -Nru syscp-gentoo-comp/admin_settings.php syscp-mysql-ftp-imp/admin_settings.php ---- syscp-gentoo-comp/admin_settings.php 2006-03-26 00:52:22.000000000 +0100 -+++ syscp-mysql-ftp-imp/admin_settings.php 2006-03-26 00:54:43.000000000 +0100 -@@ -111,10 +111,10 @@ - $update_users = '"' . $sql['user'] . '", "' . $sql['root_user'] . '"' ; - - // Update all customer databases -- $databases = $db->query('SELECT `databasename` FROM `' . TABLE_PANEL_DATABASES . '`;'); -+ $databases = $db->query('SELECT `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '`;'); - while ( $database = $db->fetch_array ( $databases ) ) - { -- $update_users .= ', "' . $database['databasename'] .'"' ; -+ $update_users .= ', "' . $database['databaseuser'] .'"' ; - } - - // Do the update -diff -Nru syscp-gentoo-comp/customer_ftp.php syscp-mysql-ftp-imp/customer_ftp.php ---- syscp-gentoo-comp/customer_ftp.php 2006-03-26 00:52:22.000000000 +0100 -+++ syscp-mysql-ftp-imp/customer_ftp.php 2006-03-26 00:54:43.000000000 +0100 -@@ -162,10 +162,17 @@ - { - standard_error('patherror'); - } -- - else - { -- $username=$userinfo['loginname'].$settings['customer']['ftpprefix'].(intval($userinfo['ftp_lastaccountnumber'])+1); -+ $usernamesuffix=addslashes($_POST['usernamesuffix']); -+ if($usernamesuffix=='') -+ { -+ $username=$userinfo['loginname'].$settings['customer']['ftpprefix'].(intval($userinfo['ftp_lastaccountnumber'])+1); -+ } -+ else -+ { -+ $username=$userinfo['loginname'].$settings['customer']['ftpprefix'].(intval($userinfo['ftp_lastaccountnumber'])+1).'_'.$usernamesuffix; -+ } - $db->query("INSERT INTO `".TABLE_FTP_USERS."` (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) VALUES ('".$userinfo['customerid']."', '$username', ENCRYPT('$password'), '$path', 'y', '".$userinfo['guid']."', '".$userinfo['guid']."')"); - $db->query("UPDATE `".TABLE_FTP_GROUPS."` SET `members`=CONCAT_WS(',',`members`,'".$username."') WHERE `customerid`='".$userinfo['customerid']."' AND `gid`='".$userinfo['guid']."'"); - // $db->query("INSERT INTO `".TABLE_FTP_GROUPS."` (`customerid`, `groupname`, `gid`, `members`) VALUES ('".$userinfo['customerid']."', '$username', '$uid', '$username')"); -diff -Nru syscp-gentoo-comp/customer_mysql.php syscp-mysql-ftp-imp/customer_mysql.php ---- syscp-gentoo-comp/customer_mysql.php 2006-03-26 00:52:22.000000000 +0100 -+++ syscp-mysql-ftp-imp/customer_mysql.php 2006-03-26 00:54:43.000000000 +0100 -@@ -11,8 +11,9 @@ - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * -- * @author Florian Lippert <flo@redenswert.de> -+ * @author Florian Lippert <flo@redenswert.de>, Luca Longinotti <chtekk@gentoo.org> - * @copyright (C) 2003-2004 Florian Lippert -+ * @copyright (C) 2006 Luca Longinotti - * @package Panel - * @version $Id: customer_mysql.php 213 2005-08-11 21:28:10Z flo $ - */ -@@ -42,7 +43,7 @@ - { - if($action=='') - { -- $result=$db->query( "SELECT `id`, `databasename`, `description` FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . $userinfo['customerid'] . "' ORDER BY `databasename` ASC" ); -+ $result=$db->query( 'SELECT `id`, `databaseuser`, `databasename`, `description` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" ORDER BY `databasename` ASC' ); - $mysqls=''; - while($row=$db->fetch_array($result)) - { -@@ -50,13 +51,177 @@ - } - $mysqls_count = $db->num_rows($result); - -+ $result2=$db->query( 'SELECT `id`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" ORDER BY `databaseuser` ASC' ); -+ $mysqlsusers=''; -+ while($row=$db->fetch_array($result2)) -+ { -+ eval("\$mysqlsusers.=\"".getTemplate("mysql/mysqls_database_user")."\";"); -+ } -+ $mysqls_count_users = $db->num_rows($result2); -+ - eval("echo \"".getTemplate("mysql/mysqls")."\";"); - } - -+ elseif($action=='adduser') -+ { -+ if($userinfo['mysqls_used_users'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') -+ { -+ if(isset($_POST['send']) && $_POST['send']=='send') -+ { -+ $password=addslashes($_POST['password']); -+ $passwordconfirm=addslashes($_POST['passwordconfirm']); -+ if($password=='' || $passwordconfirm=='') -+ { -+ standard_error(array('stringisempty','mypassword')); -+ } -+ elseif($password != $passwordconfirm) -+ { -+ standard_error('passwordnomatch'); -+ } -+ else -+ { -+ $username=$userinfo['loginname'].$settings['customer']['mysqlprefix'].(intval($userinfo['mysql_lastusernumber'])+1); -+ -+ // Begin root-session -+ $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); -+ unset($db_root->password); -+ -+ $db_root->query( 'GRANT USAGE ON *.* TO `' . $username . '`@' . $settings['system']['mysql_access_host'] ); -+ $db_root->query( 'SET PASSWORD FOR `' . $username . '`@' . $settings['system']['mysql_access_host'] . ' = PASSWORD(\'' . $password . '\')' ); -+ $db_root->query( 'FLUSH PRIVILEGES' ); -+ -+ $db_root->close(); -+ // End root-session -+ -+ $result=$db->query( 'INSERT INTO `' . TABLE_PANEL_DATABASES_USERS . '` (`customerid`, `databaseuser`) VALUES ("' . $userinfo['customerid'] . '", "' . $username . '")' ); -+ $result=$db->query( 'UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used_users`=`mysqls_used_users`+1, `mysql_lastusernumber`=`mysql_lastusernumber`+1 WHERE `customerid`="' . $userinfo['customerid'] . '"' ); -+ -+ redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; -+ } -+ } -+ else -+ { -+ eval("echo \"".getTemplate("mysql/mysqls_add_user")."\";"); -+ } -+ } -+ } -+ -+ elseif($action=='add') -+ { -+ if($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') -+ { -+ if(isset($_POST['send']) && $_POST['send']=='send') -+ { -+ $databaseuser=addslashes($_POST['databaseuser']); -+ if($databaseuser=='') -+ { -+ standard_error('missingdbuser'); -+ } -+ else -+ { -+ $databasesuffix=addslashes($_POST['databasesuffix']); -+ if($databasesuffix=='') -+ { -+ $databasename=$userinfo['loginname'].$settings['customer']['mysqlprefix'].(intval($userinfo['mysql_lastaccountnumber'])+1); -+ } -+ else -+ { -+ $databasename=$userinfo['loginname'].$settings['customer']['mysqlprefix'].(intval($userinfo['mysql_lastaccountnumber'])+1).'_'.$databasesuffix; -+ } -+ -+ // Begin root-session -+ $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); -+ unset($db_root->password); -+ -+ $db_root->query( 'CREATE DATABASE `' . $databasename . '`' ); -+ $db_root->query( 'GRANT ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $databasename ) . '`.* TO `' . $databaseuser . '`@' . $settings['system']['mysql_access_host'] . ';' ); -+ $db_root->query( 'FLUSH PRIVILEGES' ); -+ -+ $db_root->close(); -+ // End root-session -+ -+ $databasedescription=addslashes($_POST['description']); -+ $result=$db->query( 'INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databaseuser`, `databasename`, `description`) VALUES ("' . $userinfo['customerid'] . '", "' . $databaseuser . '", "' . $databasename . '", "' . $databasedescription . '")' ); -+ $result=$db->query( 'UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . $userinfo['customerid'] . '"' ); -+ -+ redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; -+ } -+ } -+ else -+ { -+ $result=$db->query_first( 'SELECT `id`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" ORDER BY `databaseuser` ASC' ); -+ if(isset($result['databaseuser']) && $result['databaseuser'] != '') -+ { -+ $result2=$db->query( 'SELECT `id`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" ORDER BY `databaseuser` ASC' ); -+ $databaseuser=''; -+ while($row=$db->fetch_array($result2)) -+ { -+ $databaseuser.=makeoption($row['databaseuser'],$row['databaseuser']); -+ } -+ -+ eval("echo \"".getTemplate("mysql/mysqls_add")."\";"); -+ } -+ else -+ { -+ standard_error('nodbuseryet'); -+ } -+ -+ } -+ } -+ } -+ -+ elseif($action=='deleteuser' && $id!=0) -+ { -+ $result=$db->query_first( 'SELECT `id`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -+ if(isset($result['databaseuser']) && $result['databaseuser'] != '') -+ { -+ if(isset($_POST['send']) && $_POST['send']=='send') -+ { -+ $result2=$db->query_first( 'SELECT `id`, `databasename` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `databaseuser`="' . $result['databaseuser'] . '"' ); -+ if(isset($result2['databasename']) && $result2['databasename'] != '') -+ { -+ standard_error('dbuserstillhasdb'); -+ } -+ else -+ { -+ // Begin root-session -+ $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); -+ unset($db_root->password); -+ -+ $db_root->query( 'REVOKE ALL PRIVILEGES ON * . * FROM `' . $result['databaseuser'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -+ $db_root->query( 'DELETE FROM `mysql`.`user` WHERE `User` = "' . $result['databaseuser'] . '" AND `Host` = "' . $settings['system']['mysql_access_host'] . '"' ); -+ $db_root->query( 'FLUSH PRIVILEGES' ); -+ -+ $db_root->close(); -+ // End root-session -+ -+ $result=$db->query( 'DELETE FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `databaseuser`="' . $result['databaseuser'] . '"' ); -+ -+ if($userinfo['mysqls_used_users']=='1') -+ { -+ $resetusrnumber=" , `mysql_lastusernumber`='0' "; -+ } -+ else -+ { -+ $resetusrnumber=''; -+ } -+ -+ $result=$db->query( 'UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used_users`=`mysqls_used_users`-1 ' . $resetusrnumber . 'WHERE `customerid`="' . $userinfo['customerid'] .'"' ); -+ -+ redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; -+ } -+ } -+ else -+ { -+ ask_yesno('mysql_reallydelete_user', $filename, "id=$id;page=$page;action=$action", $result['databaseuser']); -+ } -+ } -+ } -+ - elseif($action=='delete' && $id!=0) - { -- $result=$db->query_first( 'SELECT `id`, `databasename` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -- if(isset($result['databasename']) && $result['databasename'] != '') -+ $result=$db->query_first( 'SELECT `id`, `databasename`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -+ if(isset($result['databasename']) && $result['databasename'] != '' && isset($result['databaseuser']) && $result['databaseuser'] != '') - { - if(isset($_POST['send']) && $_POST['send']=='send') - { -@@ -64,16 +229,14 @@ - $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); - unset($db_root->password); - -- $db_root->query( 'REVOKE ALL PRIVILEGES ON * . * FROM `' . $result['databasename'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -- $db_root->query( 'REVOKE ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $result['databasename'] ) . '` . * FROM `' . $result['databasename'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -- $db_root->query( 'DELETE FROM `mysql`.`user` WHERE `User` = "' . $result['databasename'] . '" AND `Host` = "' . $settings['system']['mysql_access_host'] . '"' ); -+ $db_root->query( 'REVOKE ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $result['databasename'] ) . '` . * FROM `' . $result['databaseuser'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); - $db_root->query( 'DROP DATABASE IF EXISTS `' . $result['databasename'] . '`' ); - $db_root->query( 'FLUSH PRIVILEGES' ); - - $db_root->close(); - // End root-session -- -- $db->query( 'DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -+ -+ $result=$db->query( 'DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `databasename`="' . $result['databasename'] . '"' ); - - if($userinfo['mysqls_used']=='1') - { -@@ -88,89 +251,97 @@ - - redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; - } -- else -+ else - { - ask_yesno('mysql_reallydelete', $filename, "id=$id;page=$page;action=$action", $result['databasename']); - } - } - } - -- elseif($action=='add') -+ elseif($action=='edituser' && $id!=0) - { -- if($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') -+ $result=$db->query_first( 'SELECT `id`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -+ if(isset($result['databaseuser']) && $result['databaseuser'] != '') - { - if(isset($_POST['send']) && $_POST['send']=='send') - { - $password=addslashes($_POST['password']); -- if($password=='') -+ $passwordconfirm=addslashes($_POST['passwordconfirm']); -+ if($password=='' || $passwordconfirm=='') - { - standard_error(array('stringisempty','mypassword')); - } -+ elseif($password != $passwordconfirm) -+ { -+ standard_error('passwordnomatch'); -+ } - else - { -- $username=$userinfo['loginname'].$settings['customer']['mysqlprefix'].(intval($userinfo['mysql_lastaccountnumber'])+1); -- - // Begin root-session - $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); - unset($db_root->password); - -- $db_root->query( 'CREATE DATABASE `' . $username . '`' ); -- $db_root->query( 'GRANT ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $username ) . '`.* TO `' . $username . '`@' . $settings['system']['mysql_access_host'] . ' IDENTIFIED BY \'password\'' ); -- $db_root->query( 'SET PASSWORD FOR `' . $username .'`@' . $settings['system']['mysql_access_host'] . ' = PASSWORD(\'' . $password . '\')' ); -- $db_root->query( 'FLUSH PRIVILEGES' ); -+ $db_root->query('SET PASSWORD FOR `' . $result['databaseuser'] . '`@' . $settings['system']['mysql_access_host'] . ' = PASSWORD(\'' . $password .'\')'); -+ $db_root->query('FLUSH PRIVILEGES'); - - $db_root->close(); - // End root-session -- -- // Statement modifyed for Database description -- PH 2004-11-29 -- $databasedescription=addslashes($_POST['description']); -- $result=$db->query( 'INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`) VALUES ("' . $userinfo['customerid'] .'", "' . $username .'", "' . $databasedescription .'")' ); -- $result=$db->query( 'UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . $userinfo['customerid'] . '"' ); -- -- redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; - } -+ -+ redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; - } -- else -+ else - { -- eval("echo \"".getTemplate("mysql/mysqls_add")."\";"); -+ eval("echo \"".getTemplate("mysql/mysqls_edit_user")."\";"); - } - } - } - - elseif($action=='edit' && $id!=0) - { -- $result=$db->query_first( 'SELECT `id`, `databasename`, `description` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -- if(isset($result['databasename']) && $result['databasename'] != '') -+ $result=$db->query_first( 'SELECT `id`, `databasename`, `databaseuser`, `description` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"' ); -+ if(isset($result['databasename']) && $result['databasename'] != '' && isset($result['databaseuser']) && $result['databaseuser'] != '') - { - if(isset($_POST['send']) && $_POST['send']=='send') - { -- // Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29 -- $password=addslashes($_POST['password']); -- if($password!='') -+ $databaseuser=addslashes($_POST['databaseuser']); -+ if($databaseuser=='') -+ { -+ standard_error('missingdbuser'); -+ } -+ else - { - // Begin root-session - $db_root=new db($sql['host'],$sql['root_user'],$sql['root_password'],''); - unset($db_root->password); - -- $db_root->query('SET PASSWORD FOR `'.$result['databasename'].'`@' . $settings['system']['mysql_access_host'] . ' = PASSWORD(\'' . $password .'\')'); -- $db_root->query('FLUSH PRIVILEGES'); -+ $db_root->query( 'REVOKE ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $result['databasename'] ) . '` . * FROM `' . $result['databaseuser'] . '`@' . $settings['system']['mysql_access_host'] . ';' ); -+ $db_root->query( 'GRANT ALL PRIVILEGES ON `' . str_replace ( '_' , '\_' , $result['databasename'] ) . '`.* TO `' . $databaseuser . '`@' . $settings['system']['mysql_access_host'] . ';' ); -+ $db_root->query( 'FLUSH PRIVILEGES' ); - - $db_root->close(); - // End root-session -+ -+ $result=$db->query( 'UPDATE `' . TABLE_PANEL_DATABASES . '` SET `databaseuser`="' . $databaseuser . '" WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"'); - } - -- // Update the Database description -- PH 2004-11-29 - $databasedescription=addslashes($_POST['description']); - $result=$db->query( 'UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $databasedescription . '" WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"'); - -- redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; -+ redirectTo ( $filename , Array ( 'page' => $page , 's' => $s ) ) ; - } -- else -+ else - { -+ $result2=$db->query( 'SELECT `id`, `databaseuser` FROM `' . TABLE_PANEL_DATABASES_USERS . '` WHERE `customerid`="' . $userinfo['customerid'] . '" ORDER BY `databaseuser` ASC' ); -+ $databaseuser=''; -+ while($row=$db->fetch_array($result2)) -+ { -+ $databaseuser.=makeoption($row['databaseuser'],$row['databaseuser'],$result['databaseuser']); -+ } -+ - eval("echo \"".getTemplate("mysql/mysqls_edit")."\";"); - } - } - } - } -- - ?> -\ No newline at end of file -diff -Nru syscp-gentoo-comp/lib/functions.php syscp-mysql-ftp-imp/lib/functions.php ---- syscp-gentoo-comp/lib/functions.php 2006-03-26 00:52:22.000000000 +0100 -+++ syscp-mysql-ftp-imp/lib/functions.php 2006-03-26 00:54:43.000000000 +0100 -@@ -650,6 +650,12 @@ - 'FROM `'.TABLE_PANEL_DATABASES.'` ' . - 'WHERE `customerid` = "'.$customer['customerid'].'"' - ); -+ -+ $customer_mysqls_users = $db->query_first( -+ 'SELECT COUNT(*) AS `number_mysqls_users` ' . -+ 'FROM `'.TABLE_PANEL_DATABASES_USERS.'` ' . -+ 'WHERE `customerid` = "'.$customer['customerid'].'"' -+ ); - - $customer_emails = $db->query_first( - 'SELECT COUNT(*) AS `number_emails` ' . -@@ -695,6 +701,7 @@ - $db->query( - 'UPDATE `'.TABLE_PANEL_CUSTOMERS.'` ' . - 'SET `mysqls_used` = "'.$customer_mysqls['number_mysqls'].'", ' . -+ ' `mysqls_used_users` = "'.$customer_mysqls_users['number_mysqls_users'].'", ' . - ' `emails_used` = "'.$customer_emails['number_emails'].'", ' . - ' `email_accounts_used` = "'.$customer_email_accounts.'", ' . - ' `email_forwarders_used` = "'.$customer_email_forwarders.'", ' . -diff -Nru syscp-gentoo-comp/lib/tables.inc.php syscp-mysql-ftp-imp/lib/tables.inc.php ---- syscp-gentoo-comp/lib/tables.inc.php 2006-03-26 00:52:22.000000000 +0100 -+++ syscp-mysql-ftp-imp/lib/tables.inc.php 2006-03-26 00:54:43.000000000 +0100 -@@ -24,6 +24,7 @@ - define('TABLE_PANEL_ADMINS','panel_admins'); - define('TABLE_PANEL_CUSTOMERS','panel_customers'); - define('TABLE_PANEL_DATABASES','panel_databases'); -+define('TABLE_PANEL_DATABASES_USERS','panel_databases_users'); - define('TABLE_PANEL_DOMAINS','panel_domains'); - define('TABLE_PANEL_HTACCESS','panel_htaccess'); - define('TABLE_PANEL_HTPASSWDS','panel_htpasswds'); -diff -Nru syscp-gentoo-comp/lng/english.lng.php syscp-mysql-ftp-imp/lng/english.lng.php ---- syscp-gentoo-comp/lng/english.lng.php 2006-03-26 00:52:22.000000000 +0100 -+++ syscp-mysql-ftp-imp/lng/english.lng.php 2006-03-26 01:00:45.000000000 +0100 -@@ -143,8 +143,6 @@ - /** - * MySQL - */ --$lng['mysql']['databasename'] = 'user/database name'; --$lng['mysql']['databasedescription'] = 'database description'; - $lng['mysql']['database_create'] = 'Create database'; - - /** -@@ -363,7 +361,6 @@ - /** - * CHANGED BETWEEN 1.2.12 and 1.2.13 - */ --$lng['mysql']['description'] = 'Here you can create and change your MySQL-Databases.<br />The changes are made instantly and the database can be used immediately.<br />At the menu on the left side you find the tool phpMyAdmin with which you can easily administer your database.<br /><br />To use your databases in your own php-scripts use the following settings: (The data in <i>italics</i> have to be changed into the equivalents you typed in!)<br />Hostname: <b>localhost</b><br />Username: <b><i>Databasename</i></b><br />Password: <b><i>the password you\'ve chosen</i></b><br />Database: <b><i>Databasename</i></b>'; - - /** - * ADDED BETWEEN 1.2.12 and 1.2.13 -@@ -392,4 +389,28 @@ - // ADDED IN 1.2.13-rc3 - $lng['error']['cantchangesystemip'] = 'You cannot change the last system IP, either create another new IP/Port combination for the system IP or change the system IP.'; - $lng['question']['admin_domain_reallydocrootoutofcustomerroot'] = 'Are you sure, you want the document root for this domain, not being within the customerroot of the customer?'; -+ -+/** -+ * CHANGED FOR MYSQL/FTP IMPROVED PATCH -+ */ -+$lng['mysql']['description'] = 'Here you can create and change your MySQL databases.<br />The changes are made instantly and the databases can be used immediately.<br />At the menu on the left side you\'ll find the tool phpMyAdmin with which you can easily administer your databases.<br /><br />To use your databases in your own PHP scripts use the following settings: (The data in <i>italics</i> have to be changed into the equivalents you typed in!)<br />Hostname: <b>localhost</b><br />Username: <b><i>the username you\'ve chosen for that database</i></b><br />Password: <b><i>the password you\'ve chosen for that user</i></b><br />Database: <b><i>the name of the database</i></b>'; -+$lng['mysql']['databasename'] = 'Database name'; -+$lng['mysql']['databasedescription'] = 'Database description'; -+ -+/** -+ * ADDED FOR MYSQL/FTP IMPROVED PATCH -+ */ -+$lng['menue']['mysql']['users'] = 'Users'; -+$lng['mysql']['databaseuser'] = 'Database user'; -+$lng['mysql']['databasesuffix'] = 'Database suffix'; -+$lng['mysql']['password_confirm'] = 'Password (confirm)'; -+$lng['mysql']['database_create_user'] = 'Create user'; -+$lng['mysql']['database_change'] = 'Change database settings'; -+$lng['mysql']['database_change_user'] = 'Change user settings'; -+$lng['error']['passwordnomatch'] = 'The passwords you inserted do not match.'; -+$lng['error']['missingdbuser'] = 'You need to select an user for the database.'; -+$lng['error']['nodbuseryet'] = 'You need to create a database user first!'; -+$lng['error']['dbuserstillhasdb'] = 'You cannot delete this database user, databases are still assigned to it!<br />Please reassign or delete all databases assigned to this user first.'; -+$lng['question']['mysql_reallydelete_user'] = 'Do you really want to delete the user %s? This cannot be undone!'; -+$lng['ftp']['ftpsuffix'] = 'Account suffix'; - ?> -\ No newline at end of file -diff -Nru syscp-gentoo-comp/templates/customer/ftp/accounts_add.tpl syscp-mysql-ftp-imp/templates/customer/ftp/accounts_add.tpl ---- syscp-gentoo-comp/templates/customer/ftp/accounts_add.tpl 2006-03-26 00:54:10.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/ftp/accounts_add.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -13,7 +13,11 @@ - </tr> - <tr> - <td class="install_nomecampo">{$lng['login']['password']}:</td> -- <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="password" size="30" /></td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="password" size="30" maxlength="50" /></td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['ftp']['ftpsuffix']}:<br />({$lng['panel']['emptyfordefault']})</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="text" name="usernamesuffix" size="30" maxlength="50" /></td> - </tr> - <tr> - <td class="install_confermacampo" colspan="2"><input type="hidden" name="send" value="send" /><input type="submit" class="bottone" value="{$lng['ftp']['account_add']}" /></td> -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls_add.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_add.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls_add.tpl 2006-03-26 00:54:10.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_add.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -8,12 +8,16 @@ - <td class="install_titolo" colspan="2"><b><img src="../images/titolo.gif" alt="" /> {$lng['mysql']['database_create']}</b></td> - </tr> - <tr> -- <td class="install_nomecampo">{$lng['mysql']['databasedescription']}:</td> -- <td class="install_campodisplay" nowrap="nowrap"><input type="text" name="description" maxlength="100" /></td> -+ <td class="install_nomecampo">{$lng['mysql']['databasesuffix']}:<br />({$lng['panel']['emptyfordefault']})</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="text" name="databasesuffix" maxlength="50" /></td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['login']['username']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><select name="databaseuser">$databaseuser</select></td> - </tr> - <tr> -- <td class="install_nomecampo">{$lng['login']['password']}:</td> -- <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="password" maxlength="50" /></td> -+ <td class="install_nomecampo">{$lng['mysql']['databasedescription']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="text" name="description" maxlength="100" /></td> - </tr> - <tr> - <td class="install_confermacampo" colspan="2"><input type="hidden" name="send" value="send" /><input type="submit" class="bottone" value="{$lng['mysql']['database_create']}" /></td> -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls_add_user.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_add_user.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls_add_user.tpl 1970-01-01 01:00:00.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_add_user.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -0,0 +1,25 @@ -+$header -+ <form method="post" action="$filename"> -+ <input type="hidden" name="s" value="$s" /> -+ <input type="hidden" name="page" value="$page" /> -+ <input type="hidden" name="action" value="$action" /> -+ <table cellpadding="5" cellspacing="4" border="0" align="center" class="install_tabella_60"> -+ <tr> -+ <td class="install_titolo" colspan="2"><b><img src="../images/titolo.gif" alt="" /> {$lng['mysql']['database_create_user']}</b></td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['login']['password']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="password" maxlength="50" /></td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['mysql']['password_confirm']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="passwordconfirm" maxlength="50" /></td> -+ </tr> -+ <tr> -+ <td class="install_confermacampo" colspan="2"><input type="hidden" name="send" value="send" /><input type="submit" class="bottone" value="{$lng['mysql']['database_create_user']}" /></td> -+ </tr> -+ </table> -+ </form> -+ <br /> -+ <br /> -+$footer -\ No newline at end of file -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls_database.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_database.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls_database.tpl 2006-03-26 00:54:10.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_database.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -1,5 +1,6 @@ - <tr> - <td class="nomecampo_bordosx">{$row['databasename']}</td> -+ <td class="nomecampo">{$row['databaseuser']}</td> - <td class="nomecampo">{$row['description']}</td> - <td class="nomecampo"><a href="$filename?page=mysqls&action=edit&id={$row['id']}&s=$s">{$lng['panel']['edit']}</a></td> - <td class="nomecampo"><a href="$filename?page=mysqls&action=delete&id={$row['id']}&s=$s">{$lng['panel']['delete']}</a></td> -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls_database_user.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_database_user.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls_database_user.tpl 1970-01-01 01:00:00.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_database_user.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -0,0 +1,5 @@ -+<tr> -+ <td class="nomecampo_bordosx">{$row['databaseuser']}</td> -+ <td class="nomecampo"><a href="$filename?page=mysqls&action=edituser&id={$row['id']}&s=$s">{$lng['panel']['edit']}</a></td> -+ <td class="nomecampo"><a href="$filename?page=mysqls&action=deleteuser&id={$row['id']}&s=$s">{$lng['panel']['delete']}</a></td> -+</tr> -\ No newline at end of file -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls_edit.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_edit.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls_edit.tpl 2006-03-26 00:54:10.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_edit.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -6,19 +6,19 @@ - <input type="hidden" name="id" value="$id" /> - <table cellpadding="5" cellspacing="4" border="0" align="center" class="install_tabella_60"> - <tr> -- <td class="install_titolo" colspan="2"><b><img src="../images/titolo.gif" alt="" /> {$lng['menue']['main']['changepassword']}</b></td> -+ <td class="install_titolo" colspan="2"><b><img src="../images/titolo.gif" alt="" /> {$lng['mysql']['database_change']}</b></td> - </tr> - <tr> - <td class="install_nomecampo">{$lng['mysql']['databasename']}:</td> - <td class="install_campodisplay" nowrap="nowrap">{$result['databasename']}</td> - </tr> - <tr> -- <td class="install_nomecampo">{$lng['mysql']['databasedescription']}:</td> -- <td class="install_campodisplay" nowrap="nowrap"><input type="text" name="description" maxlength="100" value="{$result['description']}" /></td> -+ <td class="install_nomecampo">{$lng['login']['username']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><select name="databaseuser">$databaseuser</select></td> - </tr> - <tr> -- <td class="install_nomecampo">{$lng['changepassword']['new_password_ifnotempty']}:</td> -- <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="password" maxlength="50" /></td> -+ <td class="install_nomecampo">{$lng['mysql']['databasedescription']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="text" name="description" maxlength="100" value="{$result['description']}" /></td> - </tr> - <tr> - <td class="install_confermacampo" colspan="2"><input type="hidden" name="send" value="send" /><input type="submit" class="bottone" value="{$lng['panel']['save']}" /></td> -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls_edit_user.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_edit_user.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls_edit_user.tpl 1970-01-01 01:00:00.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls_edit_user.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -0,0 +1,30 @@ -+$header -+ <form method="post" action="$filename"> -+ <input type="hidden" name="s" value="$s" /> -+ <input type="hidden" name="page" value="$page" /> -+ <input type="hidden" name="action" value="$action" /> -+ <input type="hidden" name="id" value="$id" /> -+ <table cellpadding="5" cellspacing="4" border="0" align="center" class="install_tabella_60"> -+ <tr> -+ <td class="install_titolo" colspan="2"><b><img src="../images/titolo.gif" alt="" /> {$lng['mysql']['database_change_user']}</b></td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['mysql']['databaseuser']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap">{$result['databaseuser']}</td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['login']['password']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="password" maxlength="50" /></td> -+ </tr> -+ <tr> -+ <td class="install_nomecampo">{$lng['mysql']['password_confirm']}:</td> -+ <td class="install_campodisplay" nowrap="nowrap"><input type="password" name="passwordconfirm" maxlength="50" /></td> -+ </tr> -+ <tr> -+ <td class="install_confermacampo" colspan="2"><input type="hidden" name="send" value="send" /><input type="submit" class="bottone" value="{$lng['panel']['save']}" /></td> -+ </tr> -+ </table> -+ </form> -+ <br /> -+ <br /> -+$footer -\ No newline at end of file -diff -Nru syscp-gentoo-comp/templates/customer/mysql/mysqls.tpl syscp-mysql-ftp-imp/templates/customer/mysql/mysqls.tpl ---- syscp-gentoo-comp/templates/customer/mysql/mysqls.tpl 2006-03-26 00:54:10.000000000 +0100 -+++ syscp-mysql-ftp-imp/templates/customer/mysql/mysqls.tpl 2006-03-26 00:54:43.000000000 +0100 -@@ -1,22 +1,45 @@ - $header - <table cellpadding="5" cellspacing="0" border="0" align="center" class="install_tabella"> - <tr> -- <td class="install_titolo" colspan="4"><b><img src="../images/titolo.gif" alt="" /> {$lng['menue']['mysql']['databases']}</b></td> -+ <td class="install_titolo" colspan="5"><b><img src="../images/titolo.gif" alt="" /> {$lng['menue']['mysql']['databases']}</b></td> - </tr> - <tr> - <td class="campodisplay_bordosx">{$lng['mysql']['databasename']}</td> -+ <td class="campodisplay">{$lng['mysql']['databaseuser']}</td> - <td class="campodisplay">{$lng['mysql']['databasedescription']}</td> - <td class="campodisplay" colspan="2"> </td> - </tr> - <if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') && 15 < $mysqls_count > - <tr> -- <td class="campodisplay_bordosx" colspan="4"><a href="$filename?page=mysqls&action=add&s=$s">{$lng['mysql']['database_create']}</a></td> -+ <td class="campodisplay_bordosx" colspan="5"><a href="$filename?page=mysqls&action=add&s=$s">{$lng['mysql']['database_create']}</a></td> - </tr> - </if> - $mysqls - <if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') > - <tr> -- <td class="campodisplay_bordosx" colspan="4"><a href="$filename?page=mysqls&action=add&s=$s">{$lng['mysql']['database_create']}</a></td> -+ <td class="campodisplay_bordosx" colspan="5"><a href="$filename?page=mysqls&action=add&s=$s">{$lng['mysql']['database_create']}</a></td> -+ </tr> -+ </if> -+ </table> -+ <br /> -+ <br /> -+ <table cellpadding="5" cellspacing="0" border="0" align="center" class="install_tabella_40"> -+ <tr> -+ <td class="install_titolo" colspan="3"><b><img src="../images/titolo.gif" alt="" /> {$lng['menue']['mysql']['users']}</b></td> -+ </tr> -+ <tr> -+ <td class="campodisplay_bordosx">{$lng['mysql']['databaseuser']}</td> -+ <td class="campodisplay" colspan="2"> </td> -+ </tr> -+ <if ($userinfo['mysqls_used_users'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') && 15 < $mysqls_count_users > -+ <tr> -+ <td class="campodisplay_bordosx" colspan="3"><a href="$filename?page=mysqls&action=adduser&s=$s">{$lng['mysql']['database_create_user']}</a></td> -+ </tr> -+ </if> -+ $mysqlsusers -+ <if ($userinfo['mysqls_used_users'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') > -+ <tr> -+ <td class="campodisplay_bordosx" colspan="3"><a href="$filename?page=mysqls&action=adduser&s=$s">{$lng['mysql']['database_create_user']}</a></td> - </tr> - </if> - </table> |