]> git.joonet.de Git - adminer.git/commitdiff
Integrate port to server
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 8 Nov 2007 12:20:18 +0000 (12:20 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 8 Nov 2007 12:20:18 +0000 (12:20 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@358 7c3ca157-0c34-0410-bff1-cbf682f78f5c

abstraction.inc.php
auth.inc.php
lang/cs.inc.php
lang/nl.inc.php
lang/sk.inc.php

index 400d69346fe5d75615b26c4550c06f8482cdad18..aa56905e7aacc27f1f3c7704e34bfe239a47cffb 100644 (file)
@@ -5,9 +5,10 @@ if (extension_loaded("mysqli")) {
                        $this->init();
                }
                
-               function connect($server, $username, $password, $port) {
+               function connect($server, $username, $password) {
+                       list($host, $port) = explode(":", $server, 2);
                        return @$this->real_connect(
-                               (strlen($server) ? $server : ini_get("mysqli.default_host")),
+                               (strlen($server) ? $host : ini_get("mysqli.default_host")),
                                (strlen("$server$username") ? $username : ini_get("mysqli.default_user")),
                                (strlen("$server$username$password") ? $password : ini_get("mysqli.default_pw")),
                                null,
@@ -27,9 +28,9 @@ if (extension_loaded("mysqli")) {
        class Min_MySQL {
                var $_link, $_result, $server_info, $affected_rows, $error;
                
-               function connect($server, $username, $password, $port) {
+               function connect($server, $username, $password) {
                        $this->_link = @mysql_connect(
-                               (strlen($server) ? $server : ini_get("mysql.default_host")) . (strlen($port) ? ":$port" : ""),
+                               (strlen($server) ? $server : ini_get("mysql.default_host")),
                                (strlen("$server$username") ? $username : ini_get("mysql.default_user")),
                                (strlen("$server$username$password") ? $password : ini_get("mysql.default_password")),
                                131072 // CLIENT_MULTI_RESULTS for CALL
@@ -115,9 +116,9 @@ if (extension_loaded("mysqli")) {
                function __construct() {
                }
                
-               function connect($server, $username, $password, $port) {
+               function connect($server, $username, $password) {
                        set_exception_handler('auth_error'); // try/catch is not compatible with PHP 4
-                       parent::__construct("mysql:host=$server" . (strlen($port) ? ";port=$port" : ""), $username, $password);
+                       parent::__construct("mysql:host=" . str_replace(":", ";port=", $server), $username, $password);
                        restore_exception_handler();
                        $this->setAttribute(13, array('Min_PDOStatement')); // PDO::ATTR_STATEMENT_CLASS
                        $this->server_info = $this->result($this->query("SELECT VERSION()"));
index e1cef5290efe4afac34a65044249d343c12ea123..d3f8e5562ad0aa14dc433b734a3aeb4d063bb27d 100644 (file)
@@ -8,7 +8,6 @@ if (isset($_POST["server"])) {
                session_regenerate_id();
                $_SESSION["usernames"][$_POST["server"]] = $_POST["username"];
                $_SESSION["passwords"][$_POST["server"]] = $_POST["password"];
-               $_SESSION["ports"][$_POST["server"]] = $_POST["port"];
                if (count($_POST) == count($ignore)) {
                        if ((string) $_GET["server"] === $_POST["server"]) {
                                $location = remove_from_uri();
@@ -26,7 +25,6 @@ if (isset($_POST["server"])) {
 } elseif (isset($_GET["logout"])) {
        unset($_SESSION["usernames"][$_GET["server"]]);
        unset($_SESSION["passwords"][$_GET["server"]]);
-       unset($_SESSION["ports"][$_GET["server"]]);
        unset($_SESSION["databases"][$_GET["server"]]);
        $_SESSION["tokens"][$_GET["server"]] = array();
        redirect(substr($SELF, 0, -1), lang('Logout successful.'));
@@ -53,7 +51,6 @@ function auth_error() {
        <tr><th><?php echo lang('Server'); ?>:</th><td><input name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /></td></tr>
        <tr><th><?php echo lang('Username'); ?>:</th><td><input name="username" value="<?php echo htmlspecialchars($username); ?>" /></td></tr>
        <tr><th><?php echo lang('Password'); ?>:</th><td><input type="password" name="password" /></td></tr>
-       <tr><th><?php echo lang('Port'); ?>:</th><td><input name="port" size="4" value="<?php echo htmlspecialchars($_SESSION["ports"][$_GET["server"]]); ?>" /></td></tr>
        </table>
        <p>
 <?php
@@ -79,7 +76,7 @@ function auth_error() {
 }
 
 $username = $_SESSION["usernames"][$_GET["server"]];
-if (!isset($username) || !$mysql->connect($_GET["server"], $username, $_SESSION["passwords"][$_GET["server"]], $_SESSION["ports"][$_GET["server"]])) {
+if (!isset($username) || !$mysql->connect($_GET["server"], $username, $_SESSION["passwords"][$_GET["server"]])) {
        auth_error();
        exit;
 }
index 844fe1d726a36ce73f2d5390a0e9aedc4b40b6e9..b7e87a66621169e1317a8e6ff3960278fc628380 100644 (file)
@@ -162,5 +162,4 @@ $translations = array(
        'Routine' => 'Procedura',
        'Grant' => 'Povolit',
        'Revoke' => 'Zakázat',
-       'Port' => 'Port',
 );
index c8875fbd39904f7f75d5eae329281c6ea6f59f7c..6f2e55b4167b3aef84375d4b979ac4d2d92c09a6 100644 (file)
@@ -162,5 +162,4 @@ $translations = array(
        'Routine' => 'Routine',
        'Grant' => 'Toekennen',
        'Revoke' => 'Intrekken',
-       'Port' => 'Poort',
 );
index 2a36442838317e78d56bcc30c485e66d74abf0b8..4ab2e8e02f08cfbc66ce83a07083656a22dac569 100644 (file)
@@ -162,5 +162,4 @@ $translations = array(
        'Routine' => 'Procedúra',
        'Grant' => 'Povoliť',
        'Revoke' => 'Zakázať',
-       'Port' => 'Port',
 );