Добавление полей в профиль git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@114 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-07-15 14:33:41 +00:00
commit 618efa7548
6 changed files with 73 additions and 106 deletions

View file

@ -88,6 +88,23 @@ switch ($field)
$this->response['new_value'] = $this->request['value']; $this->response['new_value'] = $this->request['value'];
break; break;
case 'user_icq':
$value = (int) $value;
if ($value && !preg_match('#^\d{6,15}$#', $value))
{
$this->ajax_die('Поле "ICQ" может содержать только номер icq');
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_skype':
if ($value && !preg_match("#^[a-zA-Z0-9_.\-@,]{6,32}$#", $value))
{
$this->ajax_die($lang['SKYPE_ERROR']);
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_from': case 'user_from':
case 'user_occ': case 'user_occ':
case 'user_interests': case 'user_interests':

View file

@ -660,9 +660,6 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new
$post_username = $post_subject = $post_text = $poster_ip = ''; $post_username = $post_subject = $post_text = $poster_ip = '';
$enable_bbcode = $enable_smilies = 0;
$enable_sig = 1;
$post_time = $current_time = time(); $post_time = $current_time = time();
$username = $userdata['username']; $username = $userdata['username'];
$user_id = $userdata['user_id']; $user_id = $userdata['user_id'];
@ -721,8 +718,8 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new
return; return;
} }
$post_columns = 'topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_smilies, enable_sig'; $post_columns = 'topic_id, forum_id, poster_id, post_username, post_time, poster_ip';
$post_values = "$topic_id, $forum_id, $poster_id, '$post_username', $post_time, '$poster_ip', $enable_bbcode, $enable_smilies, $enable_sig"; $post_values = "$topic_id, $forum_id, $poster_id, '$post_username', $post_time, '$poster_ip'";
DB()->query("INSERT INTO ". BB_POSTS ." ($post_columns) VALUES ($post_values)"); DB()->query("INSERT INTO ". BB_POSTS ." ($post_columns) VALUES ($post_values)");

View file

@ -1,10 +1,6 @@
<?php <?php
if ( !defined('IN_PHPBB') ) if (!defined('BB_ROOT')) die(basename(__FILE__));
{
die("Hacking attempt");
exit;
}
require(INC_DIR .'bbcode.php'); require(INC_DIR .'bbcode.php');
@ -16,15 +12,13 @@ if (!$userdata['session_logged_in'])
{ {
redirect(append_sid("login.php?redirect={$_SERVER['REQUEST_URI']}", TRUE)); redirect(append_sid("login.php?redirect={$_SERVER['REQUEST_URI']}", TRUE));
} }
if ( empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == ANONYMOUS ) if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == ANONYMOUS)
{ {
message_die(GENERAL_MESSAGE, $lang['NO_USER_ID_SPECIFIED']); bb_die($lang['NO_USER_ID_SPECIFIED']);
} }
$profiledata = get_userdata($_GET[POST_USERS_URL]); if (!$profiledata = get_userdata($_GET[POST_USERS_URL]))
if (!$profiledata)
{ {
message_die(GENERAL_MESSAGE, $lang['NO_USER_ID_SPECIFIED']); bb_die($lang['NO_USER_ID_SPECIFIED']);
} }
// //
@ -32,14 +26,14 @@ if (!$profiledata)
// Then calculate their posts per day // Then calculate their posts per day
// //
$regdate = $profiledata['user_regdate']; $regdate = $profiledata['user_regdate'];
$memberdays = max(1, round( ( time() - $regdate ) / 86400 )); $memberdays = max(1, round((TIMENOW - $regdate) / 86400));
$posts_per_day = $profiledata['user_posts'] / $memberdays; $posts_per_day = $profiledata['user_posts'] / $memberdays;
// Get the users percentage of total posts // Get the users percentage of total posts
if ( $profiledata['user_posts'] != 0 ) if ($profiledata['user_posts'] != 0)
{ {
$total_posts = get_db_stat('postcount'); $total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0; $percentage = ($total_posts) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
} }
else else
{ {
@ -53,13 +47,11 @@ if (!$ranks = $datastore->get('ranks'))
$ranks = $datastore->get('ranks'); $ranks = $datastore->get('ranks');
} }
$poster_rank = $rank_image = $rank_select = ''; $poster_rank = $rank_image = $rank_select = '';
if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank])) if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank]))
{ {
$rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : ''; $rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
$poster_rank = $ranks[$user_rank]['rank_title']; $poster_rank = $ranks[$user_rank]['rank_title'];
} }
if (IS_ADMIN) if (IS_ADMIN)
{ {
$rank_select = array($lang['NO'] => 0); $rank_select = array($lang['NO'] => 0);
@ -70,54 +62,31 @@ if (IS_ADMIN)
$rank_select = build_select('rank-sel', $rank_select, $user_rank); $rank_select = build_select('rank-sel', $rank_select, $user_rank);
} }
$temp_url = append_sid("privmsg.php?mode=post&amp;" . POST_USERS_URL . "=" . $profiledata['user_id']); if (bf($profiledata['user_opt'], 'user_opt', 'viewemail') || IS_ADMIN)
$pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
$location = ($profiledata['user_from']) ? $profiledata['user_from'] : '';
$pm = '<a href="' . $temp_url . '">' . $lang['SEND_PRIVATE_MESSAGE'] . '</a>';
if ( bf($profiledata['user_opt'], 'user_opt', 'viewemail') || IS_ADMIN )
{ {
$email_uri = ( $bb_cfg['board_email_form'] ) ? append_sid("profile.php?mode=email&amp;" . POST_USERS_URL .'=' . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email']; $email_uri = ($bb_cfg['board_email_form']) ? append_sid('profile.php?mode=email&amp;'. POST_USERS_URL .'='. $profiledata['user_id']) : 'mailto:'. $profiledata['user_email'];
$email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['SEND_EMAIL'] . '" title="' . $lang['SEND_EMAIL'] . '" border="0" /></a>'; $email = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
$email = '<a href="' . $email_uri . '">' . $lang['SEND_EMAIL'] . '</a>';
} }
else else
{ {
$email_img = '';
$email = ''; $email = '';
} }
$www_img = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>' : '';
$www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : '';
if ( !empty($profiledata['user_icq']) )
{
$icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
$icq_img = '<a href="http://www.icq.com/people/searched=1&uin=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
$icq = '<a href="http://www.icq.com/people/' . $profiledata['user_icq'] . '">' . $profiledata['user_icq'] . '</a>';
}
else
{
$icq_status_img = '';
$icq_img = '';
$icq = '';
}
$temp_url = append_sid("search.php?search_author=1&amp;uid={$profiledata['user_id']}"); $temp_url = append_sid("search.php?search_author=1&amp;uid={$profiledata['user_id']}");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['SEARCH_USER_POSTS'] . '" title="' . sprintf($lang['SEARCH_USER_POSTS'], $profiledata['username']) . '" border="0" /></a>'; $search = '<a href="'. $temp_url .'">'. sprintf($lang['SEARCH_USER_POSTS'], $profiledata['username']) .'</a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['SEARCH_USER_POSTS'], $profiledata['username']) . '</a>';
// Report // Report
// //
// Get report user module and create report link // Get report user module and create report link
// //
include(INC_DIR . "functions_report.php"); include(INC_DIR ."functions_report.php");
$report_user = report_modules('name', 'report_user'); $report_user = report_modules('name', 'report_user');
if ($report_user && $report_user->auth_check('auth_write')) if ($report_user && $report_user->auth_check('auth_write'))
{ {
$template->assign_block_vars('switch_report_user', array()); $template->assign_block_vars('switch_report_user', array());
$template->assign_vars(array( $template->assign_vars(array(
'U_REPORT_USER' => append_sid("report.php?mode=" . $report_user->mode . '&amp;id=' . $profiledata['user_id']), 'U_REPORT_USER' => append_sid('report.php?mode='. $report_user->mode .'&amp;id='. $profiledata['user_id']),
'L_REPORT_USER' => $report_user->lang['WRITE_REPORT']) 'L_REPORT_USER' => $report_user->lang['WRITE_REPORT'])
); );
} }
@ -132,22 +101,6 @@ if ($profiledata['user_id'] == $userdata['user_id'] || IS_ADMIN)
display_upload_attach_box_limits($profiledata['user_id']); display_upload_attach_box_limits($profiledata['user_id']);
} }
// IP Mod (c) Pandora
// Не админ у админа инфу смотреть не может
if ($profiledata['user_level'] == ADMIN && !IS_ADMIN)
{
$reg_ip = $last_ip = 'скрыт';
// Модератор у модератора, ИП не может смотерть (шифруемся)
} elseif ($profiledata['user_level'] == MOD && IS_MOD)
{
$reg_ip = $last_ip = 'скрыт';
// В иных случаях может
} else {
$reg_ip = decode_ip($profiledata['user_reg_ip']);
$last_ip = decode_ip($profiledata['user_last_ip']);
}
// IP Mod End
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : ''; $signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
if(bf($profiledata['user_opt'], 'user_opt', 'allow_sig')) if(bf($profiledata['user_opt'], 'user_opt', 'allow_sig'))
@ -173,34 +126,26 @@ $template->assign_vars(array(
'RANK_SELECT' => $rank_select, 'RANK_SELECT' => $rank_select,
'POSTS_PER_DAY' => $posts_per_day, 'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'], 'POSTS' => $profiledata['user_posts'],
'PERCENTAGE' => $percentage . '%', 'PERCENTAGE' => $percentage .'%',
'POST_DAY_STATS' => sprintf($lang['USER_POST_DAY_STATS'], $posts_per_day), 'POST_DAY_STATS' => sprintf($lang['USER_POST_DAY_STATS'], $posts_per_day),
'POST_PERCENT_STATS' => sprintf($lang['USER_POST_PCT_STATS'], $percentage), 'POST_PERCENT_STATS' => sprintf($lang['USER_POST_PCT_STATS'], $percentage),
'SEARCH_IMG' => $search_img,
'SEARCH' => $search, 'SEARCH' => $search,
'PM_IMG' => $pm_img, 'PM' => '<a href="'. append_sid('privmsg.php?mode=post&amp;'. POST_USERS_URL .'='. $profiledata['user_id']) .'">'. $lang['SEND_PRIVATE_MESSAGE'] .'</a>',
'PM' => $pm,
'EMAIL_IMG' => $email_img,
'EMAIL' => $email, 'EMAIL' => $email,
'WWW_IMG' => $www_img, 'WWW' => $profiledata['user_website'],
'WWW' => $www, 'ICQ' => $profiledata['user_icq'],
'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img,
'ICQ' => $icq,
'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? bb_date($profiledata['user_lastvisit']) : $lang['NEVER'], 'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? bb_date($profiledata['user_lastvisit']) : $lang['NEVER'],
'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? bb_date($profiledata['user_session_time']) : $lang['NEVER'], 'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? bb_date($profiledata['user_session_time']) : $lang['NEVER'],
'LOCATION' => $location, 'LOCATION' => ($profiledata['user_from']) ? $profiledata['user_from'] : '',
'REG_IP' => $reg_ip,
'LAST_IP' => $last_ip,
'USER_ACTIVE' => $profiledata['user_active'], 'USER_ACTIVE' => $profiledata['user_active'],
'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : '', 'OCCUPATION' => $profiledata['user_occ'],
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '', 'INTERESTS' => $profiledata['user_interests'],
'GENDER' => ( $profiledata['user_gender'] ) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', 'SKYPE' => $profiledata['user_skype'],
'BIRTHDAY' => ( $profiledata['user_birthday'] ) ? realdate($profiledata['user_birthday'], 'Y-m-d') : '', 'GENDER' => $lang['GENDER_SELECT'][$profiledata['user_gender']],
'AGE' => ( $profiledata['user_birthday'] ) ? birthday_age($profiledata['user_birthday']) : '', 'BIRTHDAY' => ($profiledata['user_birthday']) ? realdate($profiledata['user_birthday'], 'Y-m-d') : '',
'AGE' => ($profiledata['user_birthday']) ? birthday_age($profiledata['user_birthday']) : '',
'AVATAR_IMG' => $avatar_img, 'AVATAR_IMG' => $avatar_img,
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']), 'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),

View file

@ -526,7 +526,7 @@ $lang['WEBSITE'] = 'Website';
$lang['LOCATION'] = 'Location'; $lang['LOCATION'] = 'Location';
$lang['CONTACT'] = 'Contact'; $lang['CONTACT'] = 'Contact';
$lang['EMAIL_ADDRESS'] = 'E-mail address'; $lang['EMAIL_ADDRESS'] = 'E-mail address';
$lang['SEND_PRIVATE_MESSAGE'] = 'Send private message'; $lang['SEND_PRIVATE_MESSAGE'] = 'Send pm';
$lang['HIDDEN_EMAIL'] = '[ Hidden ]'; $lang['HIDDEN_EMAIL'] = '[ Hidden ]';
$lang['INTERESTS'] = 'Interests'; $lang['INTERESTS'] = 'Interests';
$lang['OCCUPATION'] = 'Occupation'; $lang['OCCUPATION'] = 'Occupation';

View file

@ -531,7 +531,7 @@ $lang['WEBSITE'] = 'Сайт';
$lang['LOCATION'] = 'Откуда'; $lang['LOCATION'] = 'Откуда';
$lang['CONTACT'] = 'Как связаться с'; // Как связаться с Vasya_Poopkin $lang['CONTACT'] = 'Как связаться с'; // Как связаться с Vasya_Poopkin
$lang['EMAIL_ADDRESS'] = 'Адрес e-mail'; $lang['EMAIL_ADDRESS'] = 'Адрес e-mail';
$lang['SEND_PRIVATE_MESSAGE'] = 'Отправить личное сообщение'; $lang['SEND_PRIVATE_MESSAGE'] = 'Отправить ЛС';
$lang['HIDDEN_EMAIL'] = '[ скрыт ]'; $lang['HIDDEN_EMAIL'] = '[ скрыт ]';
$lang['INTERESTS'] = 'Интересы'; $lang['INTERESTS'] = 'Интересы';
$lang['OCCUPATION'] = 'Род занятий'; $lang['OCCUPATION'] = 'Род занятий';

View file

@ -72,12 +72,15 @@ $(document).ready(function(){
</script> </script>
<var class="ajax-params">{action: "edit_user_profile", id: "username"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "username"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_email"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_regdate"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_regdate"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_lastvisit"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_lastvisit"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_from"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_from"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_website"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_website"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_occ"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_occ"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_interests"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_interests"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_icq"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_skype"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_gender", editableType: "yesno-gender"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_gender", editableType: "yesno-gender"}</var>
<var class="ajax-params">{action: "edit_user_profile", id: "user_birthday"}</var> <var class="ajax-params">{action: "edit_user_profile", id: "user_birthday"}</var>
@ -123,23 +126,38 @@ $(document).ready(function(){
</p> </p>
<h4 class="cat border bw_TB" id="username">{L_CONTACT} <span class="editable bold">{USERNAME}</span></h4> <h4 class="cat border bw_TB" id="username">{L_CONTACT} <span class="editable bold">{USERNAME}</span></h4>
<table class="borderless user_contacts w100"> <table class="nowrap borderless user_contacts w100">
<!-- IF EMAIL_IMG --> <!-- IF EMAIL -->
<tr> <tr>
<th>{L_EMAIL_ADDRESS}:</th> <th>{L_EMAIL_ADDRESS}:</th>
<td>{EMAIL_IMG}</td> <td class="tLeft med" id="user_email">{EMAIL}</td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF PM_IMG --> <!-- IF PM -->
<tr> <tr>
<th>{L_PRIVATE_MESSAGE}:</th> <th>{L_PRIVATE_MESSAGE}:</th>
<td>{PM_IMG}</td> <td class="tLeft med">{PM}</td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF ICQ_IMG --> <!-- IF ICQ -->
<tr> <tr>
<th>{L_ICQ}:</th> <th>{L_ICQ}:</th>
<td>{ICQ_IMG}</td> <td class="tLeft med" id="user_icq">
<span class="editable">{ICQ}
<a href="http://www.icq.com/people/searched=1&uin={ICQ}"><img align="middle" src="http://web.icq.com/whitepages/online?icq={ICQ}&img=5"><a>
</span>
</td>
</tr>
<!-- ENDIF -->
<!-- IF SKYPE -->
<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
<tr>
<th>{L_SKYPE}:</th>
<td class="tLeft med" id="user_skype">
<span class="editable">{SKYPE}
<a href="skype:{SKYPE}"><img align="middle" src="http://mystatus.skype.com/smallicon/{SKYPE}" width="16" height="16"></a>
</span>
</td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
</table><!--/user_contacts--> </table><!--/user_contacts-->
@ -219,7 +237,7 @@ $(document).ready(function(){
<!-- IF WWW --> <!-- IF WWW -->
<tr> <tr>
<th>{L_WEBSITE}:</th> <th>{L_WEBSITE}:</th>
<td id="user_website"><b class="editable">{WWW}</b></td> <td id="user_website"><a href="{WWW}" class="editable">{WWW}</a></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF OCCUPATION --> <!-- IF OCCUPATION -->
@ -265,16 +283,6 @@ $(document).ready(function(){
<td id="ignore_srv_load">{L_ACCESS_SRV_LOAD}: <b class="editable">{IGNORE_SRV_LOAD}</b></td> <td id="ignore_srv_load">{L_ACCESS_SRV_LOAD}: <b class="editable">{IGNORE_SRV_LOAD}</b></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF IS_AM -->
<tr>
<th>{L_REG_IP}</th>
<td><b>{REG_IP}</b></td>
</tr>
<tr>
<th>{L_LAST_IP}</th>
<td><b>{LAST_IP}</b></td>
</tr>
<!-- ENDIF / SHOW_ADMIN_OPTIONS -->
</table><!--/user_details--> </table><!--/user_details-->
</td> </td>