Example #1
0
 public function vxUserModify()
 {
     echo '<div id="main">';
     echo '<div class="blank">';
     _v_ico_map();
     echo ' <a href="/">' . Vocabulary::site_name . '</a> &gt; <a href="/u/' . urlencode($this->User->usr_nick) . '">' . make_plaintext($this->User->usr_nick) . '</a> &gt; ' . $this->lang->settings() . '</div>';
     echo '<div class="blank" align="left">';
     echo '<span class="tip_i">' . $this->lang->registered_email() . '</span> ';
     _v_ico_silk('email');
     echo ' ' . $this->User->usr_email . '</div>';
     echo '<div class="blank" align="left">';
     echo '<span class="text_large">';
     _v_ico_tango_32('actions/go-up', 'absmiddle', 'home');
     echo $this->lang->upload_portrait() . '</span>';
     _v_hr();
     echo '<table cellpadding="5" cellspacing="0" border="0" class="form">';
     echo '<form enctype="multipart/form-data" action="/recv/portrait.vx" method="post" id="form_user_portrait">';
     echo '<tr><td width="200" align="right">' . $this->lang->current_portrait() . '</td><td width="200" align="left">';
     if ($this->User->usr_portrait != '') {
         echo '<img src="/img/p/' . $this->User->usr_portrait . '.' . BABEL_PORTRAIT_EXT . '?' . rand(1000, 9999) . '" alt="' . $this->User->usr_nick . '" class="portrait" />&nbsp;&nbsp;<img src="/img/p/' . $this->User->usr_portrait . '_s.' . BABEL_PORTRAIT_EXT . '?' . rand(1000, 9999) . '" class="portrait" />&nbsp;&nbsp;<img src="/img/p/' . $this->User->usr_portrait . '_n.' . BABEL_PORTRAIT_EXT . '?' . rand(1000, 9999) . '" class="portrait" />';
     } else {
         echo '<img src="/img/p_' . $this->User->usr_gender . '.gif" alt="' . $this->User->usr_nick . '" class="portrait" />&nbsp;&nbsp;<img src="/img/p_' . $this->User->usr_gender . '_s.gif" alt="' . $this->User->usr_nick . '" class="portrait" />&nbsp;&nbsp;<img src="/img/p_' . $this->User->usr_gender . '_n.gif" alt="' . $this->User->usr_nick . '" class="portrait" />';
     }
     echo '</td>';
     echo '<td width="150" rowspan="4" valign="middle" align="right">';
     _v_btn_f($this->lang->upload(), 'form_user_portrait');
     echo '</td></tr>';
     echo '<tr><td width="200" align="right">' . $this->lang->choose_a_picture() . '</td><td width="200" align="left"><input tabindex="1" type="file" name="usr_portrait" style="width: 180px;" /></td></tr>';
     if (IM_ENABLED) {
         echo '<tr><td width="200" align="right">对上传的图片做特效处理</td><td width="200" align="left"><input checked="checked" type="radio" name="fx" value="none" />&nbsp;&nbsp;不做任何修改</td></tr>';
         echo '<tr><td width="200" align="right"></td><td width="200" align="left"><input type="radio" name="fx" value="lividark" />&nbsp;&nbsp;Lividark GFX <span class="tip_i"><a href="http://www.livid.cn/img/lividark_resized.jpg" rel="lightbox" title="GFX: Lividark">查看例图</a></span></td></tr>';
         echo '<tr><td width="200" align="right"></td><td width="200" align="left"><input type="radio" name="fx" value="memory" />&nbsp;&nbsp;Memory GFX <span class="tip_i"><a href="http://www.livid.cn/img/memory_resized.jpg" rel="lightbox" title="GFX: Memory">查看例图</a></span></td></tr>';
     }
     echo '</form>';
     echo '<tr><td height="10" colspan="2"></td></tr>';
     echo '</table>';
     echo '<hr size="1" color="#DDD" style="color: #DDD; background-color: #DDD; height: 1px; border: 0;" />';
     echo '<img src="/img/icons/silk/information.png" align="absmiddle" /> ';
     echo $this->lang->upload_portrait_tips();
     echo '</div>';
     echo '<div class="blank" align="left">';
     echo '<span class="text_large">';
     _v_ico_tango_32('categories/applications-internet', 'absmiddle', 'home');
     echo $this->lang->location();
     echo '</span>';
     _v_hr();
     echo '<table cellpadding="5" cellspacing="0" border="0" class="form">';
     echo '<tr><td width="200" align="right">' . $this->lang->current_location() . '</td><td width="200" align="left"><a href="/geo/' . $this->User->usr_geo . '" class="o">' . $this->Geo->map["name"][$this->User->usr_geo] . '</a></td>';
     echo '<td width="150" rowspan="2" valign="middle" align="right">';
     _v_btn_l($this->lang->set_location(), '/user/move.vx');
     echo '</td></tr>';
     $Geo = new Geo($this->User->usr_geo, $this->Geo->map);
     $geo_md5 = md5($Geo->geo->geo);
     $geos_all_children = $Geo->vxGetRecursiveChildrenArray('', true);
     $geos_all_children_sql = implode(',', $geos_all_children);
     if ($geo_count = $this->cs->get('babel_geo_settle_count_' . $geo_md5)) {
         $geo_count = intval($geo_count);
     } else {
         $sql = "SELECT COUNT(*) FROM babel_user WHERE usr_geo IN ({$geos_all_children_sql})";
         $rs = mysql_query($sql, $this->db);
         $geo_count = intval(mysql_result($rs, 0, 0));
         mysql_free_result($rs);
         $this->cs->save(strval($geo_count), 'babel_geo_settle_count_' . $geo_md5);
     }
     echo '<tr><td width="200" align="right"><small>' . $this->lang->people_in_the_same_area() . '</small></td><td width="200" align="left"><a href="/who/settle/' . $this->User->usr_geo . '" class="t">' . $geo_count . '</a></td>';
     echo '<tr><td height="10" colspan="2"></td></tr>';
     echo '</table>';
     echo '<hr size="1" color="#DDD" style="color: #DDD; background-color: #DDD; height: 1px; border: 0;" />';
     echo '<img src="/img/icons/silk/information.png" align="absmiddle" /> ' . $this->lang->set_location_tips();
     echo '</div>';
     echo '<div class="blank" align="left">';
     echo '<span class="text_large"><a name="settings"></a>';
     _v_ico_tango_32('categories/preferences-system', 'absmiddle', 'home');
     echo $this->lang->personal_information_and_preferences() . '</span>';
     _v_hr();
     echo '<table cellpadding="5" cellspacing="0" border="0" class="form">';
     echo '<form action="/user/update.vx" method="post" id="form_user_info">';
     echo '<tr><td width="200" align="right">' . $this->lang->user_fullname() . '</td><td width="200" align="left"><input tabindex="1" type="text" maxlength="80" class="sl" name="usr_full" value="' . make_single_return($this->User->usr_full) . '" /></td>';
     // S button:
     echo '<td width="150" rowspan="18" valign="middle" align="right">';
     _v_btn_f($this->lang->update(), 'form_user_info');
     echo '</td></tr>';
     // E button.
     echo '<tr><td width="200" align="right">' . $this->lang->user_id() . '</td><td align="left"><input tabindex="2" type="text" maxlength="20" class="sl" name="usr_nick" value="' . make_single_return($this->User->usr_nick) . '" /></td></tr>';
     echo '<tr><td width="200" align="right">' . $this->lang->user_introduction() . '</td><td align="left"><input tabindex="3" type="text" maxlength="100" class="sl" name="usr_brief" value="' . make_single_return($this->User->usr_brief) . '" /></td></tr>';
     //echo('<tr><td width="200" align="right">家庭住址</td><td align="left"><input tabindex="4" type="text" maxlength="100" class="sl" name="usr_addr" value="' . make_single_return($this->User->usr_addr) . '" /></td></tr>');
     //echo('<tr><td width="200" align="right">电话</td><td align="left"><input tabindex="5" type="text" maxlength="40" class="sl" name="usr_telephone" value="' . make_single_return($this->User->usr_telephone) . '" /></td></tr>');
     echo '<tr><td width="200" align="right">Skype</td><td align="left"><input tabindex="6" type="text" maxlength="40" class="sl" name="usr_skype" value="' . make_single_return($this->User->usr_skype) . '" /></td></tr>';
     echo '<tr><td width="200" align="right">Last.fm</td><td align="left"><input tabindex="7" type="text" maxlength="40" class="sl" name="usr_lastfm" value="' . make_single_return($this->User->usr_lastfm) . '" /></td></tr>';
     //echo('<tr><td width="200" align="right">身份证号码</td><td align="left"><input tabindex="8" type="text" maxlength="18" class="sl" name="usr_identity" value="' . make_single_return($this->User->usr_identity) . '" /></td></tr>');
     /* result: usr_gender */
     echo '<tr><td width="200" align="right" valign="top">' . $this->lang->gender() . '</td><td align="left"><select tabindex="9" maxlength="20" size="6" name="usr_gender">';
     $gender_a = $this->lang->gender_categories();
     foreach ($gender_a as $c => $g) {
         if ($c == $this->User->usr_gender) {
             echo '<option value="' . $c . '" selected="selected">' . $g . '</option>';
         } else {
             echo '<option value="' . $c . '">' . $g . '</option>';
         }
     }
     echo '</select></td></tr>';
     /* result: usr_religion */
     if ($this->User->usr_religion == '') {
         $this->User->usr_religion = 'Unknown';
     }
     echo '<tr><td width="200" align="right" valign="top">' . $this->lang->religion() . '</td><td align="left"><select tabindex="10" maxlength="20" size="11" name="usr_religion">';
     $_religions = read_xml_religions();
     foreach ($_religions as $religion) {
         if (strval($religion) == $this->User->usr_religion) {
             echo '<option value="' . $religion . '" selected="selected">' . $religion . '</option>';
         } else {
             echo '<option value="' . $religion . '">' . $religion . '</option>';
         }
     }
     echo '</select></td></tr>';
     echo '<tr><td width="200" align="right" valign="top">' . $this->lang->publicise_my_religion() . '</td><td align="left"><select tabindex="11" maxlength="20" size="3" name="usr_religion_permission">';
     $_religion_permission = array($this->lang->not_to_publicise(), $this->lang->publicise(), $this->lang->publicise_to_same_religion());
     for ($i = 0; $i < 3; $i++) {
         if ($this->User->usr_religion_permission == $i) {
             echo '<option value="' . $i . '" selected="selected">' . $_religion_permission[$i] . '</option>';
         } else {
             echo '<option value="' . $i . '">' . $_religion_permission[$i] . '</option>';
         }
     }
     echo '</select></td></tr>';
     /* result: usr_width */
     $x = simplexml_load_file(BABEL_PREFIX . '/res/valid_width.xml');
     $w = $x->xpath('/array/width');
     $ws = array();
     while (list(, $width) = each($w)) {
         $ws[] = strval($width);
     }
     echo '<tr><td width="200" align="right" valign="top">' . $this->lang->preferred_screen_width() . '</td><td align="left"><select tabindex="12" maxlength="20" size="' . count($ws) . '" name="usr_width">';
     foreach ($ws as $width) {
         if ($width == $this->User->usr_width) {
             echo '<option value="' . $width . '" selected="selected">' . $width . '</option>';
         } else {
             echo '<option value="' . $width . '">' . $width . '</option>';
         }
     }
     echo '</select></td></tr>';
     // switch: top_wealth
     echo '<tr><td width="200" align="right" valign="middle"><small>' . $this->lang->top_wealth_ranking() . '</small></td><td align="left">';
     if ($this->User->usr_sw_top_wealth == 1) {
         echo '<input type="checkbox" name="usr_sw_top_wealth" tabindex="13" checked="checked" /> ' . $this->lang->participate();
     } else {
         echo '<input type="checkbox" name="usr_sw_top_wealth" tabindex="13" /> ' . $this->lang->participate();
     }
     echo '</td></tr>';
     // switch: shuffle_cloud
     echo '<tr><td width="200" align="right" valign="middle"><small>' . $this->lang->shuffle_cloud() . '</small></td><td align="left">';
     if ($this->User->usr_sw_shuffle_cloud == 1) {
         echo '<input type="checkbox" name="usr_sw_shuffle_cloud" tabindex="14" checked="checked" /> ' . $this->lang->on();
     } else {
         echo '<input type="checkbox" name="usr_sw_shuffle_cloud" tabindex="14" /> ' . $this->lang->on();
     }
     echo '</td></tr>';
     // switch: right_friends
     echo '<tr><td width="200" align="right" valign="middle"><small>' . $this->lang->sidebar_friends() . '</small></td><td align="left">';
     if ($this->User->usr_sw_right_friends == 1) {
         echo '<input type="checkbox" name="usr_sw_right_friends" tabindex="15" checked="checked" /> ' . $this->lang->on();
     } else {
         echo '<input type="checkbox" name="usr_sw_right_friends" tabindex="15" /> ' . $this->lang->on();
     }
     echo '</td></tr>';
     echo '<tr><td width="200" align="right" valign="middle"><small>' . $this->lang->v2ex_shell() . '</small></td><td align="left">';
     if ($this->User->usr_sw_shell == 1) {
         echo '<input type="checkbox" name="usr_sw_shell" tabindex="16" checked="checked" /> ' . $this->lang->on();
     } else {
         echo '<input type="checkbox" name="usr_sw_shell" tabindex="16" /> ' . $this->lang->on();
     }
     echo '</td></tr>';
     echo '<tr><td width="200" align="right" valign="middle"><small>' . $this->lang->notify_mine() . '</small></td><td align="left">';
     if ($this->User->usr_sw_notify_reply == 1) {
         echo '<input type="checkbox" name="usr_sw_notify_reply" tabindex="17" checked="checked" /> ' . $this->lang->on();
     } else {
         echo '<input type="checkbox" name="usr_sw_notify_reply" tabindex="17" /> ' . $this->lang->on();
     }
     echo '</td></tr>';
     echo '<tr><td width="200" align="right" valign="middle"><small>' . $this->lang->notify_all() . '</small></td><td align="left">';
     if ($this->User->usr_sw_notify_reply_all == 1) {
         echo '<input type="checkbox" name="usr_sw_notify_reply_all" tabindex="18" checked="checked" /> ' . $this->lang->on();
     } else {
         echo '<input type="checkbox" name="usr_sw_notify_reply_all" tabindex="18" /> ' . $this->lang->on();
     }
     echo '</td></tr>';
     echo '<tr><td width="200" align="right">' . $this->lang->notify_email() . '</td><td align="left"><input tabindex="19" type="text" maxlength="100" class="sl" name="usr_email_notify" value="' . make_single_return($this->User->usr_email_notify) . '" /></td></tr>';
     /*
     echo('<tr><td width="200" align="right">Google Account</td><td align="left">');
     if ($this->User->usr_google_account != '') {
     	echo('已绑定 <small>' . make_plaintext($this->User->usr_google_account) . '</small>');
     } else {
     	echo('未绑定');
     }
     echo('</td></tr>');
     echo('<tr><td width="200"></td><td align="left">');
     if ($this->User->usr_google_account != '') {
     	_v_btn_l('重新绑定', '/google/account/init.vx');
     } else {
     	_v_btn_l('现在绑定', '/google/account/init.vx');
     }
     echo('</td></tr>');
     */
     echo '<tr><td width="200" align="right">' . $this->lang->new_password() . '</td><td align="left"><input tabindex="20" type="password" maxlength="32" class="sl" name="usr_password_new" /></td></tr>';
     echo '<tr><td width="200" align="right">' . $this->lang->new_password_again() . '</td><td align="left"><input tabindex="21" type="password" maxlength="32" class="sl" name="usr_confirm_new" /></td></tr>';
     echo '<tr><td height="10" colspan="2"></td></tr>';
     echo '</form></table>';
     echo '<hr size="1" color="#DDD" style="color: #DDD; background-color: #DDD; height: 1px; border: 0;" />';
     echo '<img src="/img/icons/silk/information.png" align="absmiddle" /> ' . $this->lang->change_password_tips();
     echo '</div>';
     echo '</div>';
 }
 public function vxUserUpdateCheck()
 {
     $rt = array();
     $rt['errors'] = 0;
     $rt['usr_nick_value'] = '';
     /* usr_nick_error:
     		0 => no error
     		1 => empty
     		2 => overflow (12 mbs)
     		3 => invalid characters
     		4 => conflict
     		999 => unspecific */
     $rt['usr_nick_error'] = 0;
     $rt['usr_nick_error_msg'] = array(1 => '你忘记填写昵称了', 2 => '你的昵称太长了,精简一下吧', 3 => '你填写的昵称中包含了不被允许的字符', 4 => '你填写的这个昵称被别人用了');
     $rt['usr_email_notify_value'] = '';
     /* usr_email_notify_error:
     		0 => no error
     		2 => overflow (100 mbs)
     		3 => invalid format
     		999 => unspecific */
     $rt['usr_email_notify_error'] = 0;
     $rt['usr_email_notify_error_msg'] = array(2 => '邮箱地址不能超过 100 个字符', 3 => '邮箱地址不正确');
     $rt['usr_full_value'] = '';
     /* usr_full_error:
     		0 => no error
     		1 => empty
     		2 => overflow (30 mbs)
     		999 => unspecific */
     $rt['usr_full_error'] = 0;
     $rt['usr_full_error_msg'] = array(2 => '你的真实姓名长度超过了系统限制');
     $rt['usr_brief_value'] = '';
     /* usr_brief_error:
     		0 => no error
     		2 => overflow (100 mbs)
     		*/
     $rt['usr_brief_error'] = 0;
     $rt['usr_brief_error_msg'] = array(2 => '你的自我简介太长了,精简一下吧');
     $rt['usr_gender_value'] = 9;
     $rt['usr_addr_value'] = '';
     /* usr_addr_error:
     		0 => no error
     		2 => overflow (100 mbs)
     		*/
     $rt['usr_addr_error'] = 0;
     $rt['usr_addr_error_msg'] = array(2 => '你的家庭住址长度超过了系统限制');
     $rt['usr_telephone_value'] = '';
     /* usr_telephone_error:
     		0 => no error
     		2 => overflow (40 mbs)
     		*/
     $rt['usr_telephone_error'] = 0;
     $rt['usr_telephone_error_msg'] = array(2 => '你的电话号码长度超过了系统限制');
     $rt['usr_skype_value'] = '';
     /* usr_skype_error:
     		0 => no error
     		2 => overflow (40 mbs)
     		*/
     $rt['usr_skype_error'] = 0;
     $rt['usr_skype_error_msg'] = array(2 => '你的 Skype 帐号长度超过了系统限制');
     $rt['usr_lastfm_value'] = '';
     /* usr_lastfm_error:
     		0 => no error
     		2 => overflow (40 mbs)
     		*/
     $rt['usr_lastfm_error'] = 0;
     $rt['usr_lastfm_error_msg'] = array(2 => '你的 Last.fm 帐号长度超过了系统限制');
     $rt['usr_identity_value'] = '';
     /* usr_identity_error:
     		0 => no error
     		3 => invalid
     		*/
     $rt['usr_identity_error'] = 0;
     $rt['usr_identity_error_msg'] = array(3 => '身份证号码无效');
     $rt['pswitch'] = 'a';
     $rt['usr_password_value'] = '';
     $rt['usr_confirm_value'] = '';
     /* usr_password_error:
     		0 => no error
     		1 => empty
     		2 => overflow (32 sbs)
     		3 => invalid characters
     		4 => not identical
     		5 => modify empty
     		999 => unspecific */
     $rt['usr_password_error'] = 0;
     $rt['usr_password_touched'] = 0;
     $rt['usr_password_error_msg'] = array(1 => '你忘记填写密码了', 2 => '你的这个密码太长了,缩减一下吧', 3 => '你填写的密码中包含了不被允许的字符', 4 => '你所填写的两个密码不匹配', 5 => '修改密码时需将新密码输入两遍');
     /* usr_confirm_error:
     		0 => no error
     		1 => empty
     		2 => overflow (32 sbs)
     		3 => invalid characters(should not reach here in final rendering)
     		4 => not identical
     		5 => modify empty
     		999 => unspecific */
     $rt['usr_confirm_error'] = 0;
     $rt['usr_confirm_touched'] = 0;
     $rt['usr_confirm_error_msg'] = array(1 => '你忘记填写密码确认了', 2 => '你的这个密码确认太长了,缩减一下吧', 3 => '你填写的密码中包含了不被允许的字符', 4 => '你所填写的两个密码不匹配', 5 => '修改密码时需将新密码输入两遍');
     /* S check: usr_width */
     $rt['usr_width_value'] = 0;
     $x = simplexml_load_file(BABEL_PREFIX . '/res/valid_width.xml');
     $w = $x->xpath('/array/width');
     $ws = array();
     while (list(, $width) = each($w)) {
         $ws[] = strval($width);
     }
     $rt['usr_width_array'] = $ws;
     if (isset($_POST['usr_width'])) {
         $rt['usr_width_value'] = intval($_POST['usr_width']);
         if (!in_array($rt['usr_width_value'], $ws)) {
             $rt['usr_width_value'] = 800;
         }
     } else {
         $rt['usr_width_value'] = 800;
     }
     /* E check: usr_width */
     /* S check: usr_nick */
     if (isset($_POST['usr_nick'])) {
         $rt['usr_nick_value'] = make_single_safe($_POST['usr_nick']);
         if (strlen($rt['usr_nick_value']) == 0) {
             $rt['usr_nick_error'] = 1;
             $rt['errors']++;
         } else {
             if (mb_strlen($rt['usr_nick_value'], 'UTF-8') > 12) {
                 $rt['usr_nick_error'] = 2;
                 $rt['errors']++;
             } else {
                 if (!is_valid_nick($rt['usr_nick_value'])) {
                     $rt['usr_nick_error'] = 3;
                     $rt['errors']++;
                 }
             }
         }
     } else {
         $rt['usr_nick_error'] = 1;
         $rt['errors']++;
     }
     if ($rt['usr_nick_error'] == 0) {
         $sql = "SELECT usr_nick FROM babel_user WHERE usr_nick = '" . $rt['usr_nick_value'] . "' AND usr_id != " . $this->User->usr_id;
         $rs = mysql_query($sql, $this->db);
         if (mysql_num_rows($rs) > 0) {
             $rt['usr_nick_error'] = 4;
             $rt['errors']++;
         }
         mysql_free_result($rs);
     }
     /* E check: usr_nick */
     /* S check: usr_email_notify */
     if (isset($_POST['usr_email_notify'])) {
         $rt['usr_email_notify_value'] = make_single_safe($_POST['usr_email_notify']);
         if (mb_strlen($rt['usr_email_notify_value'], 'UTF-8') > 100) {
             $rt['usr_email_notify_error'] = 2;
             $rt['errors']++;
         } else {
             if (mb_strlen($rt['usr_email_notify_value'], 'UTF-8') > 0) {
                 if (!is_valid_email($rt['usr_email_notify_value'])) {
                     $rt['usr_email_notify_error'] = 3;
                     $rt['errors']++;
                 }
             }
         }
     }
     /* E check: usr_email_notify */
     /* S check: usr_full */
     if (isset($_POST['usr_full'])) {
         $rt['usr_full_value'] = make_single_safe($_POST['usr_full']);
         if (mb_strlen($rt['usr_full_value'], 'UTF-8') > 30) {
             $rt['usr_full_error'] = 2;
             $rt['errors']++;
         }
     }
     /* E check: usr_full */
     /* S check: usr_gender */
     if (isset($_POST['usr_gender'])) {
         $rt['usr_gender_value'] = intval($_POST['usr_gender']);
         if (!in_array($rt['usr_gender_value'], array(0, 1, 2, 5, 6, 9))) {
             $rt['usr_gender_value'] = 9;
         }
     } else {
         $rt['usr_gender_value'] = 9;
     }
     /* E check: usr_gender */
     /* S check: usr_addr */
     if (isset($_POST['usr_addr'])) {
         $rt['usr_addr_value'] = make_single_safe($_POST['usr_addr']);
         if (mb_strlen($rt['usr_addr_value'], 'UTF-8') > 100) {
             $rt['usr_addr_error'] = 2;
             $rt['errors']++;
         }
     }
     /* E check: usr_addr */
     /* S check: usr_telephone */
     if (isset($_POST['usr_telephone'])) {
         $rt['usr_telephone_value'] = make_single_safe($_POST['usr_telephone']);
         if (mb_strlen($rt['usr_telephone_value'], 'UTF-8') > 40) {
             $rt['usr_telephone_error'] = 2;
             $rt['errors']++;
         }
     }
     /* E check: usr_telephone */
     /* S check: usr_skype */
     if (isset($_POST['usr_skype'])) {
         $rt['usr_skype_value'] = make_single_safe($_POST['usr_skype']);
         if (mb_strlen($rt['usr_skype_value'], 'UTF-8') > 40) {
             $rt['usr_skype_error'] = 2;
             $rt['errors']++;
         }
     }
     /* E check: usr_skype */
     /* S check: usr_lastfm */
     if (isset($_POST['usr_lastfm'])) {
         $rt['usr_lastfm_value'] = make_single_safe($_POST['usr_lastfm']);
         if (mb_strlen($rt['usr_lastfm_value'], 'UTF-8') > 40) {
             $rt['usr_lastfm_error'] = 2;
             $rt['errors']++;
         }
     }
     /* E check: usr_lastfm */
     /* S check: usr_identity */
     if (isset($_POST['usr_identity'])) {
         $rt['usr_identity_value'] = make_single_safe($_POST['usr_identity']);
         if (mb_strlen($rt['usr_identity_value'], 'UTF-8') > 0) {
             if (in_array(mb_strlen($rt['usr_identity_value'], 'UTF-8'), array(15, 18))) {
                 if (!preg_match('/[a-zA-Z0-9]+/', $rt['usr_identity_value'])) {
                     $rt['usr_identity_error'] = 3;
                     $rt['errors']++;
                 }
             }
         }
     }
     /* E check: usr_identity */
     /* S check: usr_brief */
     if (isset($_POST['usr_brief'])) {
         $rt['usr_brief_value'] = make_single_safe($_POST['usr_brief']);
         if (mb_strlen($rt['usr_brief_value'], 'UTF-8') > 0) {
             if (mb_strlen($rt['usr_brief_value'], 'UTF-8') > 100) {
                 $rt['usr_brief_error'] = 2;
                 $rt['errors']++;
             }
         }
     }
     /* E check: usr_brief */
     /* S check: usr_religion */
     /* default: Unknown */
     $_religions = read_xml_religions();
     if (isset($_POST['usr_religion'])) {
         $rt['usr_religion_value'] = make_single_safe($_POST['usr_religion']);
         if (!in_array($rt['usr_religion_value'], $_religions)) {
             $rt['usr_religion_value'] = 'Unknown';
         }
     } else {
         $rt['usr_religion_value'] = 'Unknown';
     }
     /* E check: usr_religion */
     /* S check: usr_religion_permission */
     /* default: 0 */
     /* options:
     		   0 => secret (default)
     		   1 => public
     		   2 => public to the same
     		 */
     if (isset($_POST['usr_religion_permission'])) {
         $rt['usr_religion_permission_value'] = intval($_POST['usr_religion_permission']);
         if (!in_array($rt['usr_religion_permission_value'], array(0, 1, 2))) {
             $rt['usr_religion_permission_value'] = 0;
         }
     } else {
         $rt['usr_religion_permission_value'] = 0;
     }
     /* E check: usr_religion_permission */
     /* S check: usr_sw_shuffle_cloud */
     /* default: 1 */
     if (isset($_POST['usr_sw_shuffle_cloud'])) {
         if (strtolower($_POST['usr_sw_shuffle_cloud']) == 'on') {
             $rt['usr_sw_shuffle_cloud_value'] = 1;
         } else {
             $rt['usr_sw_shuffle_cloud_value'] = 0;
         }
     } else {
         $rt['usr_sw_shuffle_cloud_value'] = 0;
     }
     /* E check: usr_sw_shuffle_cloud */
     /* S check: usr_sw_right_friends */
     /* default: 0 */
     if (isset($_POST['usr_sw_right_friends'])) {
         if (strtolower($_POST['usr_sw_right_friends']) == 'on') {
             $rt['usr_sw_right_friends_value'] = 1;
         } else {
             $rt['usr_sw_right_friends_value'] = 0;
         }
     } else {
         $rt['usr_sw_right_friends_value'] = 0;
     }
     /* E check: usr_sw_right_friends */
     /* S check: usr_sw_top_wealth */
     /* default: 0 */
     if (isset($_POST['usr_sw_top_wealth'])) {
         if (strtolower($_POST['usr_sw_top_wealth']) == 'on') {
             $rt['usr_sw_top_wealth_value'] = 1;
         } else {
             $rt['usr_sw_top_wealth_value'] = 0;
         }
     } else {
         $rt['usr_sw_top_wealth_value'] = 0;
     }
     /* E check: usr_sw_top_wealth */
     /* S check: usr_sw_shell */
     if (isset($_POST['usr_sw_shell'])) {
         if (strtolower($_POST['usr_sw_shell']) == 'on') {
             $rt['usr_sw_shell_value'] = 1;
         } else {
             $rt['usr_sw_shell_value'] = 0;
         }
     } else {
         $rt['usr_sw_shell_value'] = 0;
     }
     /* E check: usr_sw_shell */
     /* S check: usr_sw_notify_reply */
     if (isset($_POST['usr_sw_notify_reply'])) {
         if (strtolower($_POST['usr_sw_notify_reply']) == 'on') {
             $rt['usr_sw_notify_reply_value'] = 1;
         } else {
             $rt['usr_sw_notify_reply_value'] = 0;
         }
     } else {
         $rt['usr_sw_notify_reply_value'] = 0;
     }
     /* E check: usr_sw_notify_reply */
     /* S check: usr_sw_notify_reply_all */
     if (isset($_POST['usr_sw_notify_reply_all'])) {
         if (strtolower($_POST['usr_sw_notify_reply_all']) == 'on') {
             $rt['usr_sw_notify_reply_all_value'] = 1;
         } else {
             $rt['usr_sw_notify_reply_all_value'] = 0;
         }
     } else {
         $rt['usr_sw_notify_reply_all_value'] = 0;
     }
     /* E check: usr_sw_notify_reply_all */
     /* S check: usr_password and usr_confirm */
     if (isset($_POST['usr_password_new'])) {
         $rt['usr_password_value'] = $_POST['usr_password_new'];
         if (strlen($rt['usr_password_value']) == 0) {
             $rt['usr_password_touched'] = 0;
         } else {
             $rt['usr_password_touched'] = 1;
         }
     } else {
         $rt['usr_password_touched'] = 0;
     }
     if (isset($_POST['usr_confirm_new'])) {
         $rt['usr_confirm_value'] = $_POST['usr_confirm_new'];
         if (strlen($rt['usr_confirm_value']) == 0) {
             $rt['usr_confirm_touched'] = 0;
         } else {
             $rt['usr_confirm_touched'] = 1;
         }
     } else {
         $rt['usr_confirm_touched'] = 0;
     }
     if ($rt['usr_password_touched'] == 0 && $rt['usr_confirm_touched'] == 0) {
         $rt['pswitch'] = 'a';
     }
     if ($rt['usr_password_touched'] == 1 && $rt['usr_confirm_touched'] == 1) {
         $rt['pswitch'] = 'b';
     }
     if ($rt['usr_password_touched'] == 1 && $rt['usr_confirm_touched'] == 0) {
         $rt['pswitch'] = 'c';
     }
     if ($rt['usr_password_touched'] == 0 && $rt['usr_confirm_touched'] == 1) {
         $rt['pswitch'] = 'd';
     }
     switch ($rt['pswitch']) {
         default:
         case 'a':
             /* nothing will happen */
             break;
         case 'b':
             /* a lot check here */
             if (strlen($rt['usr_password_value']) > 32) {
                 $rt['usr_password_error'] = 2;
                 $rt['errors']++;
             }
             if (strlen($rt['usr_confirm_value']) > 32) {
                 $rt['usr_confirm_error'] = 2;
                 $rt['errors']++;
             }
             if ($rt['usr_password_error'] == 0 && $rt['usr_confirm_error'] == 0) {
                 if ($rt['usr_password_value'] != $rt['usr_confirm_value']) {
                     $rt['usr_confirm_error'] = 4;
                     $rt['errors']++;
                 }
             }
             break;
         case 'c':
             $rt['usr_confirm_error'] = 5;
             $rt['errors']++;
             break;
         case 'd':
             $rt['usr_password_error'] = 5;
             $rt['errors']++;
             break;
     }
     return $rt;
 }