- bug fixed : in admin, username displayed in titles if needed even if only
user id was transmitted git-svn-id: http://piwigo.org/svn/trunk@708 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
f760cdb987
commit
54e615890c
2 changed files with 39 additions and 1 deletions
14
admin.php
14
admin.php
|
@ -34,7 +34,19 @@ include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
|
|||
$page_valide = false;
|
||||
$title = '';
|
||||
$username='';
|
||||
if (isset($_POST['username'])) $username=$_POST['username'];
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
$username = $_POST['username'];
|
||||
}
|
||||
else if (isset($_POST['userid']))
|
||||
{
|
||||
$username = get_username($_POST['userid']);
|
||||
}
|
||||
else if (isset($_GET['user_id']))
|
||||
{
|
||||
$username = get_username($_GET['user_id']);
|
||||
}
|
||||
|
||||
if (isset( $_GET['page'] ))
|
||||
switch ( $_GET['page'] )
|
||||
{
|
||||
|
|
|
@ -353,4 +353,30 @@ INSERT INTO '.USER_FORBIDDEN_TABLE.'
|
|||
|
||||
return $forbidden_categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the username corresponding to the given user identifier if exists
|
||||
*
|
||||
* @param int user_id
|
||||
* @return mixed
|
||||
*/
|
||||
function get_username($user_id)
|
||||
{
|
||||
$query = '
|
||||
SELECT username
|
||||
FROM '.USERS_TABLE.'
|
||||
WHERE id = '.intval($user_id).'
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
if (mysql_num_rows($result) > 0)
|
||||
{
|
||||
list($username) = mysql_fetch_row($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $username;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue