Пример #1
0
      $people->sendCreationNotice($params['user_id']);      
      $display["msg"] .= display_ok_msg("$l_user : $l_insert_ok");
      $display["detail"] = dis_people_consult($params);
    } else {
      $display["msg"] .= display_err_msg("$l_user : $l_insert_error");
      $display["detail"] = html_people_form("", $params);
      }
  // Form data are not valid
  } else {
    $display["msg"] .= display_err_msg($l_invalid_data . " : " . $err["msg"]);
    $display["detail"] = html_people_form("", $params, $err["field"]);
  }

} elseif ($action == 'update') {
///////////////////////////////////////////////////////////////////////////////
  if (check_user_defined_rules() && check_user_data_form($params['user_id'], $params)) {
    $retour = run_query_people_update($params['user_id'], $params);
    if ($retour) {
      set_update_state();
      $display['msg'] .= display_ok_msg("$l_user : $l_update_ok");
      $display['detail'] = dis_people_consult($params);
    } else {
      $display['msg'] .= display_err_msg("$l_user : $l_update_error");
      $display['detail'] = html_people_form('', $params, $err['field']);
    }
  } else {
    $display['msg'] .= display_err_msg($err['msg']);
    $display['detail'] = html_people_form('', $params, $err['field']);
  }

} elseif ($action == 'display') {
Пример #2
0
  /**
   * Update user information.
   * @param $login A username.
   * @param $domain_id A valid domain identifier.
   * @param $user_id The corresponding user identifier.
   * @return int The user identifier, or false.
   */
  function updateUser($login, $domain_id, $user_id)
  {
    global $obm;

    //
    // Some internal functions used global variables
    // Set those internal variables to be in a known state
    //

    $backup['domain_id'] = $obm['domain_id'];
    $backup['uid'] = $obm['uid'];
    $backup['globals_module'] = $GLOBALS['module'];

    $obm['uid'] = $user_id;
    $obm['domain_id'] = $domain_id;
    $GLOBALS['module'] = 'user';

    //
    // We have to retrieve all informations from database. Do not
    // be worried, OBM return hash which could contains int index
    // also. That does not match $params structure, so we will
    // remove those type of index.
    //

    $params = $this->_buildInternalUserData($login, $domain_id);
    $params_db = $this->getUserDataFromId($user_id, $domain_id);
    foreach ($params_db as $key => $value)
    {
      if (array_key_exists($key, $params))
        $params_db[$key] = $params[$key];
    }
    $params_db = $this->_setDefaultUserData($params_db, $login, $domain_id);

    $params['action'] = DEFAULT_OBM_MODTYPE_UPDATE;

    //
    // The above code is taken from php/user/user_index.php, when
    // $user['action'] equals to 'update'.
    //

    $succeed = false ;
    if (check_user_data_form($user_id, $params_db)
        && run_query_user_update($user_id, $params_db))
    {
      $this->_updated = true;
      $succeed = $user_id;
    }

    $obm['uid'] = $backup['uid'];
    $obm['domain_id'] = $backup['domain_id'];
    $GLOBALS['module'] = $backup['globals_module'];
    unset($backup);

    return $succeed;
  }