Merge branch 'master' into multiquery

This commit is contained in:
Madhura Jayaratne 2014-12-01 16:51:48 +05:30
commit f9e430e0d3
6 changed files with 34 additions and 0 deletions

View File

@ -988,6 +988,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$controllink = $userlink;
}
$auth_plugin->storeUserCredentials();
/* Log success */
PMA_logUser($cfg['Server']['user']);

View File

@ -38,6 +38,15 @@ abstract class AuthenticationPlugin
*/
abstract public function authSetUser();
/**
* Stores user credentials after successful login.
*
* @return void
*/
public function storeUserCredentials()
{
}
/**
* User is not allowed to login to MySQL -> authentication failed
*

View File

@ -560,6 +560,16 @@ class AuthenticationCookie extends AuthenticationPlugin
} else {
$_SESSION['last_access_time'] = time();
}
}
/**
* Stores user credentials after successful login.
*
* @return void
*/
public function storeUserCredentials()
{
global $cfg;
$this->createIV();

View File

@ -803,6 +803,8 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
isset($_SERVER['PHP_AUTH_PW'])
);
$this->object->storeUserCredentials();
$this->assertTrue(
isset($_COOKIE['pmaUser-1'])
);
@ -872,6 +874,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
$attrInstance->setValue($mockResponse);
$this->object->authSetUser();
$this->object->storeUserCredentials();
$this->assertTrue(
isset($_COOKIE['pmaServer-2'])

View File

@ -40,6 +40,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config']->enableBc();
$GLOBALS['server'] = 0;
$GLOBALS['lang'] = "en";
$GLOBALS['text_dir'] = "ltr";
$GLOBALS['available_languages'] = array(
"en" => array("English", "US-ENGLISH"),
"ch" => array("Chinese", "TW-Chinese")

View File

@ -217,6 +217,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
->setMethods(array('addHtml'))
->getMock();
$restoreInstance = PMA_Response::getInstance();
$response = new ReflectionProperty('PMA_Response', '_instance');
$response->setAccessible(true);
$response->setValue($responseMock);
@ -225,6 +226,8 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
array(false), 0, array('1'), 'SELECT', array('1' => 'result1')
);
$response->setValue($restoreInstance);
$this->assertFalse($result);
}
@ -1926,12 +1929,15 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
->method('getHeader')
->will($this->returnValue($headerMock));
$restoreInstance = PMA_Response::getInstance();
$response = new ReflectionProperty('PMA_Response', '_instance');
$response->setAccessible(true);
$response->setValue($responseMock);
PMA_isInsertRow();
$response->setValue($restoreInstance);
$this->assertEquals(5, $GLOBALS['cfg']['InsertRows']);
}
@ -2765,6 +2771,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
->setMethods(array('addHtml'))
->getMock();
$restoreInstance = PMA_Response::getInstance();
$response = new ReflectionProperty('PMA_Response', '_instance');
$response->setAccessible(true);
$response->setValue($responseMock);
@ -2792,6 +2799,8 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
$result = PMA_determineInsertOrEdit(null, 'db', 'table');
$response->setValue($restoreInstance);
$this->assertEquals(
array(
true,