Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/functions.js47
-rwxr-xr-xjs/messages.php1
-rwxr-xr-xlibraries/display_change_password.lib.php2
-rwxr-xr-xmain.php9
-rwxr-xr-xuser_password.php13
5 files changed, 68 insertions, 4 deletions
diff --git a/js/functions.js b/js/functions.js
index 1bcac63d46..5dfb27e755 100755
--- a/js/functions.js
+++ b/js/functions.js
@@ -2072,4 +2072,51 @@ $(document).ready(function() {
}
})
})
+})
+
+/**
+ * jQuery coding for 'Change Password' on main.php
+ */
+$(document).ready(function() {
+
+ $('#change_password_anchor').live('click', function(event) {
+ event.preventDefault();
+
+ var button_options = {};
+
+ button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
+
+ $.get($(this).attr('href'), {'ajax_request': true}, function(data) {
+ $('<div id="change_password_dialog></div>')
+ .dialog({
+ title: top.frame_content.PMA_messages['strChangePassword'],
+ width: 600,
+ buttons : button_options
+ })
+ .append(data);
+ })
+ })
+
+ $("#change_password_form").find('input[name=change_pw]').live('click', function(event) {
+ event.preventDefault();
+
+ var the_form = $("#change_password_form");
+
+ PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
+ $(the_form).append('<input type="hidden" name="ajax_request" value="true" />');
+
+ $.post($(the_form).attr('action'), $(the_form).serialize(), function(data) {
+ if(data.success == true) {
+
+ PMA_ajaxShowMessage(data.message);
+
+ $("#topmenucontainer").after(data.sql_query);
+
+ $("#change_password_dialog").hide().remove();
+ }
+ else {
+ PMA_ajaxShowMessage(data.error);
+ }
+ })
+ })
}) \ No newline at end of file
diff --git a/js/messages.php b/js/messages.php
index fefc5d523e..7e538e7c6d 100755
--- a/js/messages.php
+++ b/js/messages.php
@@ -103,6 +103,7 @@ $js_messages['strChangeDisplay'] = __('Choose column to display');
/* password generation */
$js_messages['strGeneratePassword'] = __('Generate password');
$js_messages['strGenerate'] = __('Generate');
+$js_messages['strChangePassword'] = __('Change Password');
echo "var PMA_messages = new Array();\n";
foreach ($js_messages as $name => $js_message) {
diff --git a/libraries/display_change_password.lib.php b/libraries/display_change_password.lib.php
index 43a61f6ef2..e7bdad29e4 100755
--- a/libraries/display_change_password.lib.php
+++ b/libraries/display_change_password.lib.php
@@ -19,7 +19,7 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
// Displays the form
?>
-<form method="post" action="<?php echo $GLOBALS['PMA_PHP_SELF']; ?>" name="chgPassword" onsubmit="return checkPassword(this)">
+<form method="post" id="change_password_form" action="<?php echo $GLOBALS['PMA_PHP_SELF']; ?>" name="chgPassword" onsubmit="return checkPassword(this)">
<?php echo PMA_generate_common_hidden_inputs();
if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
echo '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
diff --git a/main.php b/main.php
index 08faf4959d..e9baae99a9 100755
--- a/main.php
+++ b/main.php
@@ -13,6 +13,7 @@ require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'colorpicker/js/colorpicker.js';
$GLOBALS['js_include'][] = 'main_custom_color.js';
+$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
// Handles some variables that may have been sent by the calling script
$GLOBALS['db'] = '';
@@ -88,7 +89,7 @@ if ($server > 0
if ($cfg['Server']['auth_type'] != 'config') {
if ($cfg['ShowChgPassword']) {
PMA_printListItem(__('Change password'), 'li_change_password',
- './user_password.php?' . $common_url_query);
+ './user_password.php?' . $common_url_query, null, null, 'change_password_anchor');
}
$http_logout = ($cfg['Server']['auth_type'] == 'http')
@@ -364,8 +365,9 @@ if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_valu
* @param string $url make item as link with $url as target
* @param string $mysql_help_page display a link to MySQL's manual
* @param string $target special target for $url
+ * @param string $a_id id for the anchor, used for jQuery to hook in functions
*/
-function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
+function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null)
{
echo '<li id="' . $id . '">';
if (null !== $url) {
@@ -373,6 +375,9 @@ function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = nu
if (null !== $target) {
echo ' target="' . $target . '"';
}
+ if (null != $a_id) {
+ echo ' id="' . $a_id .'"';
+ }
echo '>';
}
diff --git a/user_password.php b/user_password.php
index cd84b790a1..0ef8b8677a 100755
--- a/user_password.php
+++ b/user_password.php
@@ -71,6 +71,10 @@ if (isset($_REQUEST['nopass'])) {
$password = $_REQUEST['pma_pw'];
}
+ if($GLOBALS['is_ajax_request'] == true && $_error == true) {
+ PMA_ajaxResponse($message, false);
+ }
+
if (! $_error) {
// Defines the url to return to in case of error in the sql statement
@@ -101,10 +105,17 @@ if (isset($_REQUEST['nopass'])) {
$_url_params['old_usr'] = 'relog';
}
+ $message = PMA_Message::success(__('The profile has been updated.'));
+
+ if($GLOBALS['is_ajax_request'] == true) {
+ $extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query, 'success');
+ PMA_ajaxResponse($message, true, $extra_data);
+ }
+
// Displays the page
require_once './libraries/header.inc.php';
echo '<h1>' . __('Change password') . '</h1>' . "\n\n";
- PMA_showMessage(__('The profile has been updated.'), $sql_query, 'success');
+ PMA_showMessage($message, $sql_query, 'success');
?>
<a href="index.php<?php echo PMA_generate_common_url($_url_params); ?>" target="_parent">
<strong><?php echo __('Back'); ?></strong></a>