Changeset 25545


Ignore:
Timestamp:
Nov 18, 2013, 6:03:00 AM (10 years ago)
Author:
rvelices
Message:
  • ws users/groups/perms returns int instead of strings for ids
  • fix ws permissions getList (sometimes got objects sometimes arrays)
  • users_list data table uses POST (avoid extra lengthy urls)
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/user_list.tpl

    r25502 r25545  
    206206          jQuery("#action select[name=associate] option").each(function() {
    207207            var selected = '';
    208             if (user.groups.indexOf(jQuery(this).val()) != -1) {
     208            if (user.groups.indexOf( parseInt(jQuery(this).val()) ) != -1) {
    209209              selected = ' selected="selected"';
    210210            }
     
    554554    "bProcessing": true,
    555555    "bServerSide": true,
     556                "sServerMethod": "POST",
    556557    "sAjaxSource": "admin/user_list_backend.php",
    557558    "oLanguage": {
  • trunk/admin/user_list_backend.php

    r25475 r25545  
    2929 */
    3030$sLimit = "";
    31 if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
     31if ( isset( $_REQUEST['iDisplayStart'] ) && $_REQUEST['iDisplayLength'] != '-1' )
    3232{
    33   $sLimit = "LIMIT ".pwg_db_real_escape_string( $_GET['iDisplayStart'] ).", ".
    34     pwg_db_real_escape_string( $_GET['iDisplayLength'] );
     33  $sLimit = "LIMIT ".pwg_db_real_escape_string( $_REQUEST['iDisplayStart'] ).", ".
     34    pwg_db_real_escape_string( $_REQUEST['iDisplayLength'] );
    3535}
    3636       
     
    3939 * Ordering
    4040 */
    41 if ( isset( $_GET['iSortCol_0'] ) )
     41if ( isset( $_REQUEST['iSortCol_0'] ) )
    4242{
    4343  $sOrder = "ORDER BY  ";
    44   for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
     44  for ( $i=0 ; $i<intval( $_REQUEST['iSortingCols'] ) ; $i++ )
    4545  {
    46     if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
     46    if ( $_REQUEST[ 'bSortable_'.intval($_REQUEST['iSortCol_'.$i]) ] == "true" )
    4747    {
    48       $sOrder .= $aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."
    49                                         ".pwg_db_real_escape_string( $_GET['sSortDir_'.$i] ) .", ";
     48      $sOrder .= $aColumns[ intval( $_REQUEST['iSortCol_'.$i] ) ]."
     49                                        ".pwg_db_real_escape_string( $_REQUEST['sSortDir_'.$i] ) .", ";
    5050    }
    5151  }
     
    6666 */
    6767$sWhere = "";
    68 if ( $_GET['sSearch'] != "" )
     68if ( $_REQUEST['sSearch'] != "" )
    6969{
    7070  $sWhere = "WHERE (";
    7171  for ( $i=0 ; $i<count($aColumns) ; $i++ )
    7272  {
    73     $sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string( $_GET['sSearch'] )."%' OR ";
     73    $sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string( $_REQUEST['sSearch'] )."%' OR ";
    7474  }
    7575  $sWhere = substr_replace( $sWhere, "", -3 );
     
    8080for ( $i=0 ; $i<count($aColumns) ; $i++ )
    8181{
    82   if ( $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
     82  if ( $_REQUEST['bSearchable_'.$i] == "true" && $_REQUEST['sSearch_'.$i] != '' )
    8383  {
    8484    if ( $sWhere == "" )
     
    9090      $sWhere .= " AND ";
    9191    }
    92     $sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string($_GET['sSearch_'.$i])."%' ";
     92    $sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string($_REQUEST['sSearch_'.$i])."%' ";
    9393  }
    9494}
     
    130130 */
    131131$output = array(
    132   "sEcho" => intval($_GET['sEcho']),
     132  "sEcho" => intval($_REQUEST['sEcho']),
    133133  "iTotalRecords" => $iTotal,
    134134  "iTotalDisplayRecords" => $iFilteredTotal,
  • trunk/include/ws_functions/pwg.permissions.php

    r25281 r25545  
    5858    if (!isset($perms[ $row['cat_id'] ]))
    5959    {
    60       $perms[ $row['cat_id'] ]['id'] = $row['cat_id'];
    61     }
    62     $perms[ $row['cat_id'] ]['users'][] = $row['user_id'];
     60      $perms[ $row['cat_id'] ]['id'] = intval($row['cat_id']);
     61    }
     62    $perms[ $row['cat_id'] ]['users'][] = intval($row['user_id']);
    6363  }
    6464
     
    7777    if (!isset($perms[ $row['cat_id'] ]))
    7878    {
    79       $perms[ $row['cat_id'] ]['id'] = $row['cat_id'];
    80     }
    81     $perms[ $row['cat_id'] ]['users_indirect'][] = $row['user_id'];
     79      $perms[ $row['cat_id'] ]['id'] = intval($row['cat_id']);
     80    }
     81    $perms[ $row['cat_id'] ]['users_indirect'][] = intval($row['user_id']);
    8282  }
    8383
     
    9494    if (!isset($perms[ $row['cat_id'] ]))
    9595    {
    96       $perms[ $row['cat_id'] ]['id'] = $row['cat_id'];
    97     }
    98     $perms[ $row['cat_id'] ]['groups'][] = $row['group_id'];
     96      $perms[ $row['cat_id'] ]['id'] = intval($row['cat_id']);
     97    }
     98    $perms[ $row['cat_id'] ]['groups'][] = intval($row['group_id']);
    9999  }
    100100
     
    121121    }
    122122
    123     $cat['groups'] = !empty($cat['groups']) ? array_unique($cat['groups']) : array();
    124     $cat['users'] = !empty($cat['users']) ? array_unique($cat['users']) : array();
    125     $cat['users_indirect'] = !empty($cat['users_indirect']) ? array_unique($cat['users_indirect']) : array();
     123    $cat['groups'] = !empty($cat['groups']) ? array_values(array_unique($cat['groups'])) : array();
     124    $cat['users'] = !empty($cat['users']) ? array_values(array_unique($cat['users'])) : array();
     125    $cat['users_indirect'] = !empty($cat['users_indirect']) ? array_values(array_unique($cat['users_indirect'])) : array();
    126126  }
    127127  unset($cat);
  • trunk/include/ws_functions/pwg.users.php

    r25474 r25545  
    168168;';
    169169
    170   $users = hash_from_query($query, 'id');
     170  $users = array();
     171  $result = pwg_query($query);
     172  while ($row = pwg_db_fetch_assoc($result))
     173  {
     174    $row['id'] = intval($row['id']);
     175    $users[ $row['id'] ] = $row;
     176  }
    171177
    172178  if (count($users) > 0)
     
    183189      while ($row = pwg_db_fetch_assoc($result))
    184190      {
    185         $users[ $row['user_id'] ]['groups'][] = $row['group_id'];
     191        $users[ $row['user_id'] ]['groups'][] = intval($row['group_id']);
    186192      }
    187193    }
Note: See TracChangeset for help on using the changeset viewer.