<?php
# Subroutine: adm_user_form.php called by Admin.php
# Xinfeng Chen, 2002.11.22
# Input: $user

require_once('bin/config.php');
require_once('admin/adm.inc');

#--- Validate dministrator ---
include('admin/adm_validate.php');
if(!$adm_validated){jumpTo('admin.php?cmd=logon'); exit;}

#--- Start Processing ---
require_once('core/class_forum_base.php');
CForumBase::setFileBase("$filepath");
require_once('core/base_memo_file.php');
require_once('core/class_user.php');
require_once('core/class_rank.php');

#--- Prepare User info ---
$oUsr=new CUser;
if(!$oUsr->load($user)){
 msgBox('User not foud',mCRITICAL);
 exit;
}

if($oUsr->gender == "女"){$sexselected=selected;}
$iconOption='';
for($i=0; $i<190; $i++){
 $selected=($oUsr->icon==$i)?'selected':'';
 $oo=($i<10)?"0":"";
 $iconOption.="<option value=$oo$i $selected>$oo$i</option>";
}

$oRnk=new CRank;
$oRnk->load();
$rsize=count($oRnk->level);
$rankOption='';
foreach($oRnk->level as $key=>$val){
 $selected=($oUsr->levelname==$key)?'selected':'';
 $rankOption.="<option value=$key $selected>$key</option>";
}

list($_year,$_month,$_day)=explode('-',$oUsr->birthday);

$_monthSelection="<SELECT name=f_month>";
for($ii=1; $ii<=12; $ii++){
 $_monthSelection.=($ii==$_month) ? '<option selected>' : '<option>';
 $_monthSelection.=($ii<10) ? "0$ii" : "$ii";
 $_monthSelection.='</option>';
}
$_monthSelection.='</SELECT>';

$_daySelection="<SELECT name=f_day>";
for($ii=1; $ii<=31; $ii++){
 $_daySelection.=($ii==$_day) ? '<option selected>' : '<option>';
 $_daySelection.=($ii<10) ? "0$ii" : "$ii";
 $_daySelection.='</option>';
}
$_daySelection.='</SELECT>';

#--- Print User from ---
page_header();

print <<<EOT
<script>
function New(para_URL){
var URL=new String(para_URL);
window.open(URL,'','resizable,scrollbars')
}
</script>
<FORM method="post" action="?cmd=user_submit" name="form">
<TABLE cellpadding="4" cellspacing="1" width="100%" class="forumline">
<TR><th class="thHead" colspan=2> <b>用户资料</b></th></TR>
<TR><TD class="row3" colspan=2> ● 带 <FONT color=red>*</FONT> 为必填 </TD></TR>
<TR> 
 <TD align=right width="186" class="row1"><FONT color=red>*</FONT>网上尊称：</TD>
 <TD width="466" class="row2"> 
 <INPUT readonly name=f_user value='$oUsr->name'>
 ($oUsr->firsttime - $oUsr->lasttime)</TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">用户新密码：</TD>
 <TD width="466" class="row2"> 
 <input type="password" name=f_newpass>
 <FONT color=red>如果不更改密码，此处请留空！</font></TD>
</TR>
<TR> 
 <TD align=right width=180 class=row1><FONT color=red>*</FONT> 用户Email地址：</TD>
 <TD width="466" class="row2"> 
 <INPUT maxLength=80 name=f_email value='$oUsr->email'>
 </TD>
</TR>
<TR>
 <TD align=right width=186 class=row1><FONT color=red>*</FONT> 用户生日：</TD>
 <TD class=row2>
 <INPUT name=f_year value='$_year' size=4 maxlength=4>年
 {$_monthSelection}月{$_daySelection}日
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">性　　别：</TD>
 <TD width="466" class="row2"> 
 <select name=f_gender>
 <option value=男>男</option>
 <option value=女 $sexselected>女</option>
 </select>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">职　　业：</TD>
 <TD width="466" class="row2"> 
 <INPUT maxLength=80 name=f_career value='$oUsr->career'>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">爱　　好：</TD>
 <TD width="466" class="row2"> 
 <INPUT maxLength=20 name=f_hobby value='$oUsr->hobby'>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">QQ　号码：</TD>
 <TD width="466" class="row2"> 
 <INPUT maxLength=20 name=f_ims value='$oUsr->ims'>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">个人主页：</TD>
 <TD width="466" class="row2"> 
 <INPUT name=f_homepage size=30 value='$oUsr->homepage'>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">个人信息：<br>
 </TD>
 <TD width="466" class="row2"> 
 <textarea name=f_desc cols=60 rows=5>$oUsr->desc</textarea>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">签名档：<br>
EOT;

if ($zcodeallowed) {
 print "<FONT color=red>（支持 <a href=# onclick=javascript:window.open('$imgurl/zbb.htm','','width=500,height=300,resizable,scrollbars')>ZBB 代码</a>）</FONT>";
}

print <<<EOT
 </TD>
 <TD width="466" class="row2"> 
 <textarea name=f_signature cols=60 rows=5>$oUsr->signature</textarea>
 </TD>
</TR>
<TR> 
 <TD align=right width="186" class="row1">所在省份：</TD>
 <TD width="466" class="row2"> 
 <INPUT maxLength=12 name=f_location value='$oUsr->location'>
 </TD>
</TR>
<tr> 
 <td align=right width="186" class="row1">选择头像：</td>
 <td width="466" class="row2">&nbsp;<img src="$imgurl/face/{$oUsr->icon}.gif" name="tus">&nbsp;&nbsp; 
 <script>
function showimage(){
document.images.tus.src="$imgurl/face/"+document.form.f_icon.options[document.form.f_icon.selectedIndex].value+".gif";
}
 </script>
 <select name=f_icon size=1 onChange="showimage()">
 <option value=''>默认</option>
 $iconOption
 </select>
 <a href=JavaScript:New('$imgurl/index.htm')>查看所有的头像列表</a></td>
</tr>
<tr align="center"> 
 <td colspan=2 class="catHead">统计信息</td>
</tr>
<tr>
 <td colspan=2>
 <TABLE board=0 cellpadding="4" cellspacing="1" width="100%">
 <tr>
  <td align=right width="186" class="row1">发贴数量：</td>
  <td width="466" class="row2">
  <input maxlength=10 name=f_numpost value='$oUsr->numpost' size="10">
  </td>
  <td align=right width="186" class="row1">回贴数量：</td>
  <td width="466" class="row2">
  <input maxlength=10 name=f_numreply value='$oUsr->numreply' size="10">
  </td>
 </tr>
 <tr> 
  <td align=right width="186" class="row1">等级分数：</td>
  <td width="466" class="row2">
  <input maxlength=10 name=f_level value='$oUsr->level' size="10">
  </td>
  <td align=right width="186" class="row1">等级名称：</td>
  <td width="466" class="row2">
  <select name=f_levelname>
  <option value=''>未定义</option>
  $rankOption
  </select>
  </td>
 </tr>
 <tr> 
  <td align=right width="186" class="row1">新消息数：</td>
  <td width="466" class="row2">
  <input maxlength=10 name=f_msg value='$oUsr->msg' size="10">
  </td>
  <td align=right width="186" class="row1">总消息数：</td>
  <td width="466" class="row2">
  <input maxlength=10 name=f_oldmsg value='$oUsr->oldmsg' size="10">
  </td>
 </tr>
 <tr>
 </TABLE>
 </td>
</tr>
<tr> 
 <TD colspan="2" class="catBottom" align="center"> 
 <input type="submit" value="填好了，继续！" name="submit">
 </TD>
</TR>
</TABLE></FORM>
EOT;

page_footer();

?>