Changeset 295


Ignore:
Timestamp:
Jan 18, 2004, 10:57:35 PM (20 years ago)
Author:
z0rglub
Message:

Prevent Php warnings if some user variables are NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/release-1_3/include/user.inc.php

    r274 r295  
    103103// of the array $user.
    104104foreach ( $infos as $info ) {
    105   // If the field is true or false, the variable is transformed into a
    106   // boolean value.
    107   if ( $row[$info] == 'true' or $row[$info] == 'false' )
     105  if ( isset( $row[$info] ) )
    108106  {
    109     $user[$info] = get_boolean( $row[$info] );
    110   }
    111   else if ( $info == 'forbidden_categories' )
    112   {
    113     $user[$info] = $row[$info];
    114     $user['restrictions'] = explode( ',', $row[$info] );
    115     if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array();
     107    // If the field is true or false, the variable is transformed into a
     108    // boolean value.
     109    if ( $row[$info] == 'true' or $row[$info] == 'false' )
     110      $user[$info] = get_boolean( $row[$info] );
     111    else
     112      $user[$info] = $row[$info];   
    116113  }
    117114  else
    118115  {
    119     $user[$info] = $row[$info];   
     116    $user[$info] = '';
    120117  }
    121118}
     119
     120// special for $user['restrictions'] array
     121$user['restrictions'] = explode( ',', $user['forbidden_categories'] );
     122if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array();
    122123?>
Note: See TracChangeset for help on using the changeset viewer.