<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

  /*===================================================
    ShowFormEditUser()
  ===================================================*/

  function ShowFormEditUser() {

    // vars global configuration
    global $admin_template_path;

    // vars url & form
    global $username;

    // vars messages

    // vars template
    global $error_msg, $name, $email, $homepage, $icq, $yahoo, $aol, $biography,
      $interest, $location, $occupation;

    $users_obj = new clsUsers;
    $users_obj->table_name = "idx_users";
    $users_obj->template_file = $admin_template_path . "user_edit_form.html";
    $users_obj->ChangeProfile("display_form", $username, true);
  }


  /*===================================================
    ProcessFormEditUser()
  ===================================================*/

  function ProcessFormEditUser() {

    // vars global configuration
    global $admin_template_path;

    // vars url & form
    global $username, $password, $email;

    // vars messages
    global $msg;

    // vars template
    global $message;

    // verify input

    if(empty($password) && USER_AUTH_TYPE == 'plain') $error_msg = $msg["20171"];
    elseif(empty($email)) $error_msg = $msg["20172"];
    elseif(!IsEmailAddress($email)) $error_msg = $msg["20173"];

    if (empty($error_msg)) {
      $message = $msg["20181"];
      $users_obj = new clsUsers;
      $users_obj->table_name = "idx_users";
      $users_obj->template_file = $admin_template_path . "message.html";
      $users_obj->ChangeProfile("process_form",$username,true);
    }
    else {
      $message = $error_msg;
      DisplayTemplate($admin_template_path . "message.html", "\$message");
    }
  }


  /*===================================================
    main
  ===================================================*/

  include "../application.php";

  RunPreFilter(__FILE__);

  DisplayTemplate($admin_template_path . "header.html");
  if (empty($pflag)) {
    ShowFormEditUser();
  }
  elseif ($pflag == 'edit') {
    ProcessFormEditUser();
  }
  DisplayTemplate($admin_template_path . "footer.html");

  RunPostFilter(__FILE__);

?>