add two triggers and user_list_backend.php and don't fail on unknown column

git-svn-id: http://piwigo.org/svn/trunk@26618 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100 2014-01-11 13:08:26 +00:00
parent bd08050670
commit bbb59ee3f9
3 changed files with 23 additions and 11 deletions

View file

@ -36,6 +36,7 @@ check_status(ACCESS_ADMINISTRATOR);
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array('id', 'username', 'status', 'mail_address', 'registration_date');
$aColumns = trigger_change('user_list_columns', $aColumns);
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";
@ -103,7 +104,9 @@ if ( $_REQUEST['sSearch'] != "" )
/* Individual column filtering */
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
if ( $_REQUEST['bSearchable_'.$i] == "true" && $_REQUEST['sSearch_'.$i] != '' )
if (isset($_REQUEST['bSearchable_'.$i]) && isset($_REQUEST['sSearch_'.$i])
&&$_REQUEST['bSearchable_'.$i] == "true" && $_REQUEST['sSearch_'.$i] != ''
)
{
if ( $sWhere == "" )
{
@ -132,12 +135,8 @@ $sQuery = "
$rResult = pwg_query($sQuery);
/* Data set length after filtering */
$sQuery = "
SELECT FOUND_ROWS()
";
$rResultFilterTotal = pwg_query($sQuery);
$aResultFilterTotal = pwg_db_fetch_array($rResultFilterTotal);
$iFilteredTotal = $aResultFilterTotal[0];
$rResultFilterTotal = pwg_query('SELECT FOUND_ROWS();');
list($iFilteredTotal) = pwg_db_fetch_row($rResultFilterTotal);
/* Total data set length */
$sQuery = "
@ -176,6 +175,8 @@ while ( $aRow = pwg_db_fetch_array( $rResult ) )
}
$output['aaData'][] = $row;
}
$output = trigger_change('after_render_user_list', $output);
echo json_encode( $output );
?>

View file

@ -10,10 +10,7 @@ if (!isset($conf['smartpocket']))
'loop' => true,//true - false
'autohide' => 5000,//5000 - 0
);
$query = "
INSERT INTO " . CONFIG_TABLE . " (param,value,comment)
VALUES ('smartpocket' , '".pwg_db_real_escape_string(serialize($config))."' , 'loop#autohide');";
pwg_query($query);
conf_update_param('smartpocket', pwg_db_real_escape_string(serialize($config)));
load_conf_from_db();
}
elseif (count(unserialize( $conf['smartpocket'] ))!=2)

View file

@ -809,6 +809,20 @@ array(
'files' => array('include\template.class.php (FileCombiner::process_combinable)'),
'infos' => 'New in 2.6.',
),
array(
'name' => 'user_list_columns',
'type' => 'trigger_event',
'vars' => array('string[]', 'aColumns'),
'files' => array('admin\user_list_backend.php'),
'infos' => 'New in 2.6.',
),
array(
'name' => 'after_render_user_list',
'type' => 'trigger_event',
'vars' => array('array', 'output'),
'files' => array('admin\user_list_backend.php'),
'infos' => 'New in 2.6.',
),
);
?>
<!DOCTYPE html>