удаление квоты из профиля, фикс сортировки в онлайн списке пользователей git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@206 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
pherum83 2011-08-12 16:50:24 +00:00
commit 0f7437f9bf
12 changed files with 39 additions and 291 deletions

View file

@ -304,7 +304,7 @@ else if( isset($_GET['pane']) && $_GET['pane'] == 'right' )
"IP_ADDRESS" => $reg_ip,
"U_WHOIS_IP" => "http://ip-whois.net/ip_geo.php?ip=$reg_ip",
"U_USER_PROFILE" => append_sid("profile.php?mode=editprofile&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']),
"U_USER_PROFILE" => append_sid("../profile.php?mode=editprofile&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']),
));
}
}

View file

@ -1,6 +1,9 @@
<?php
/**
* Include the FAQ-File (faq.php)
*/
function attach_faq_include($lang_file)
{
global $bb_cfg, $faq, $attach_config;
@ -17,6 +20,25 @@ function attach_faq_include($lang_file)
}
}
/**
* Setup Basic Authentication
*/
// moved to auth
/**
* Setup Forum Authentication (admin/admin_forumauth.php)
*/
//admin/admin_forumauth.php
/**
* Setup Usergroup Authentication
*/
//admin/admin_ug_auth.php
/**
* Setup s_auth_can in viewforum and viewtopic (viewtopic.php/viewforum.php)
*/
function attach_build_auth_levels($is_auth, &$s_auth_can)
{
global $lang, $attach_config, $forum_id;
@ -227,212 +249,4 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, $pm_quota);
}
}
/**
* Called from usercp_viewprofile, displays the User Upload Quota Box, Upload Stats and a Link to the User Attachment Control Panel
* Groups are able to be grabbed, but it's not used within the Attachment Mod. ;)
* (includes/usercp_viewprofile.php)
*/
function display_upload_attach_box_limits($user_id, $group_id = 0)
{
global $attach_config, $bb_cfg, $lang, $template, $userdata, $profiledata;
if (intval($attach_config['disable_mod']))
{
return;
}
if (!IS_ADMIN && $userdata['user_id'] != $user_id)
{
return;
}
if (!$user_id)
{
return;
}
// Return if the user is not within the to be listed Group
if ($group_id)
{
if (!user_in_group($user_id, $group_id))
{
return;
}
}
$user_id = (int) $user_id;
$group_id = (int) $group_id;
$attachments = new attach_posting();
$attachments->page = 0;
// Get the assigned Quota Limit. For Groups, we are directly getting the value, because this Quota can change from user to user.
if ($group_id)
{
$sql = 'SELECT l.quota_limit
FROM ' . BB_QUOTA . ' q, ' . BB_QUOTA_LIMITS . ' l
WHERE q.group_id = ' . (int) $group_id . '
AND q.quota_type = ' . QUOTA_UPLOAD_LIMIT . '
AND q.quota_limit_id = l.quota_limit_id
LIMIT 1';
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get Group Quota', '', __LINE__, __FILE__, $sql);
}
if (DB()->num_rows($result) > 0)
{
$row = DB()->sql_fetchrow($result);
$attach_config['upload_filesize_limit'] = intval($row['quota_limit']);
DB()->sql_freeresult($result);
}
else
{
DB()->sql_freeresult($result);
// Set Default Quota Limit
$quota_id = intval($attach_config['default_upload_quota']);
if ($quota_id == 0)
{
$attach_config['upload_filesize_limit'] = $attach_config['attachment_quota'];
}
else
{
$sql = 'SELECT quota_limit
FROM ' . BB_QUOTA_LIMITS . '
WHERE quota_limit_id = ' . (int) $quota_id . '
LIMIT 1';
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get Quota Limit', '', __LINE__, __FILE__, $sql);
}
if (DB()->num_rows($result) > 0)
{
$row = DB()->sql_fetchrow($result);
$attach_config['upload_filesize_limit'] = $row['quota_limit'];
}
else
{
$attach_config['upload_filesize_limit'] = $attach_config['attachment_quota'];
}
DB()->sql_freeresult($result);
}
}
}
else
{
if (is_array($profiledata))
{
$attachments->get_quota_limits($profiledata, $user_id);
}
else
{
$attachments->get_quota_limits($userdata, $user_id);
}
}
if (!$attach_config['upload_filesize_limit'])
{
$upload_filesize_limit = $attach_config['attachment_quota'];
}
else
{
$upload_filesize_limit = $attach_config['upload_filesize_limit'];
}
if ($upload_filesize_limit == 0)
{
$user_quota = $lang['UNLIMITED'];
}
else
{
$size_lang = ($upload_filesize_limit >= 1048576) ? $lang['MB'] : ( ($upload_filesize_limit >= 1024) ? $lang['KB'] : $lang['BYTES'] );
if ($upload_filesize_limit >= 1048576)
{
$user_quota = (round($upload_filesize_limit / 1048576 * 100) / 100) . ' ' . $size_lang;
}
else if ($upload_filesize_limit >= 1024)
{
$user_quota = (round($upload_filesize_limit / 1024 * 100) / 100) . ' ' . $size_lang;
}
else
{
$user_quota = ($upload_filesize_limit) . ' ' . $size_lang;
}
}
// Get all attach_id's the specific user posted, but only uploads to the board and not Private Messages
$sql = 'SELECT attach_id
FROM ' . BB_ATTACHMENTS . '
WHERE user_id_1 = ' . (int) $user_id . '
GROUP BY attach_id';
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
}
$attach_ids = DB()->sql_fetchrowset($result);
$num_attach_ids = DB()->num_rows($result);
DB()->sql_freeresult($result);
$attach_id = array();
for ($j = 0; $j < $num_attach_ids; $j++)
{
$attach_id[] = intval($attach_ids[$j]['attach_id']);
}
$upload_filesize = (sizeof($attach_id) > 0) ? get_total_attach_filesize($attach_id) : 0;
$size_lang = ($upload_filesize >= 1048576) ? $lang['MB'] : ( ($upload_filesize >= 1024) ? $lang['KB'] : $lang['BYTES'] );
if ($upload_filesize >= 1048576)
{
$user_uploaded = (round($upload_filesize / 1048576 * 100) / 100) . ' ' . $size_lang;
}
else if ($upload_filesize >= 1024)
{
$user_uploaded = (round($upload_filesize / 1024 * 100) / 100) . ' ' . $size_lang;
}
else
{
$user_uploaded = ($upload_filesize) . ' ' . $size_lang;
}
$upload_limit_pct = ( $upload_filesize_limit > 0 ) ? round(( $upload_filesize / $upload_filesize_limit ) * 100) : 0;
$upload_limit_img_length = ( $upload_filesize_limit > 0 ) ? round(( $upload_filesize / $upload_filesize_limit ) * $bb_cfg['privmsg_graphic_length']) : 0;
if ($upload_limit_pct > 100)
{
$upload_limit_img_length = $bb_cfg['privmsg_graphic_length'];
}
$upload_limit_remain = ( $upload_filesize_limit > 0 ) ? $upload_filesize_limit - $upload_filesize : 100;
$l_box_size_status = sprintf($lang['UPLOAD_PERCENT_PROFILE'], $upload_limit_pct);
$template->assign_block_vars('switch_upload_limits', array());
$template->assign_vars(array(
'U_UACP' => BB_ROOT ."profile.php?mode=attachcp&amp;u=$user_id&amp;sid={$userdata['session_id']}",
'UPLOADED' => sprintf($lang['USER_UPLOADED_PROFILE'], $user_uploaded),
'QUOTA' => sprintf($lang['USER_QUOTA_PROFILE'], $user_quota),
'UPLOAD_LIMIT_IMG_WIDTH' => $upload_limit_img_length,
'UPLOAD_LIMIT_PERCENT' => $upload_limit_pct,
'PERCENT_FULL' => $l_box_size_status,
));
}
/**
* Prune Attachments (includes/prune.php)
*/
function prune_attachments($sql_post)
{
delete_attachment($sql_post);
}

View file

@ -57,7 +57,7 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.1 Beta';
$bb_cfg['tp_release_state'] = 'R205';
$bb_cfg['tp_release_state'] = 'R206';
$bb_cfg['tp_release_date'] = '12-08-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger

View file

@ -21,24 +21,6 @@ if(bf($profiledata['user_opt'], 'user_opt', 'view_profile') && IS_GUEST)
{ meta_refresh(append_sid("login.php?redirect={$_SERVER['REQUEST_URI']}", true));
bb_die("<b>{$profiledata['username']}</b> " . $lang['FORBADE_VIEWING']); }
//
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
//
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round((TIMENOW - $regdate) / 86400));
$posts_per_day = $profiledata['user_posts'] / $memberdays;
// Get the users percentage of total posts
if ($profiledata['user_posts'] != 0)
{
$total_posts = get_db_stat('postcount');
$percentage = ($total_posts) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
}
else
{
$percentage = 0;
}
$avatar_img = get_avatar($profiledata['user_avatar'], $profiledata['user_avatar_type'], !bf($profiledata['user_opt'], 'user_opt', 'allow_avatar'));
if (!$ranks = $datastore->get('ranks'))
@ -62,7 +44,7 @@ if (IS_ADMIN)
$rank_select = build_select('rank-sel', $rank_select, $user_rank);
}
if (bf($profiledata['user_opt'], 'user_opt', 'viewemail') || IS_ADMIN)
if (bf($profiledata['user_opt'], 'user_opt', 'viewemail') || IS_AM)
{
$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 = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
@ -72,9 +54,6 @@ else
$email = '';
}
$temp_url = append_sid("search.php?search_author=1&amp;uid={$profiledata['user_id']}");
$search = '<a href="'. $temp_url .'">'. sprintf($lang['SEARCH_USER_POSTS'], $profiledata['username']) .'</a>';
// Report
//
// Get report user module and create report link
@ -95,11 +74,6 @@ if ($report_user && $report_user->auth_check('auth_write'))
//
// Generate page
//
if ($profiledata['user_id'] == $userdata['user_id'] || IS_ADMIN)
{
require(BB_ROOT .'attach_mod/attachment_mod.php');
display_upload_attach_box_limits($profiledata['user_id']);
}
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
@ -124,12 +98,7 @@ $template->assign_vars(array(
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'RANK_SELECT' => $rank_select,
'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'],
'PERCENTAGE' => $percentage .'%',
'POST_DAY_STATS' => sprintf($lang['USER_POST_DAY_STATS'], $posts_per_day),
'POST_PERCENT_STATS' => sprintf($lang['USER_POST_PCT_STATS'], $percentage),
'SEARCH' => $search,
'PM' => '<a href="'. append_sid('privmsg.php?mode=post&amp;'. POST_USERS_URL .'='. $profiledata['user_id']) .'">'. $lang['SEND_PRIVATE_MESSAGE'] .'</a>',
'EMAIL' => $email,
'WWW' => $profiledata['user_website'],

View file

@ -548,8 +548,6 @@ $lang['OCCUPATION'] = 'Occupation';
$lang['POSTER_RANK'] = 'Poster rank';
$lang['TOTAL_POSTS'] = 'Total posts';
$lang['USER_POST_PCT_STATS'] = '%.2f%% of total'; // 1.25% of total
$lang['USER_POST_DAY_STATS'] = '%.2f posts per day'; // 1.5 posts per day
$lang['SEARCH_USER_POSTS'] = 'Find posts'; // Find all posts by username
$lang['SEARCH_USER_POSTS_SHORT'] = 'Find user posts';
$lang['SEARCH_USER_TOPICS'] = 'Find user topics'; // Find all topics by username
@ -1137,14 +1135,6 @@ $lang['NOTE_USER_EMPTY_GROUP_PERMISSIONS'] = 'NOTE:<br />You are normally allowe
// Quota Variables
$lang['UPLOAD_QUOTA'] = 'Upload Quota';
$lang['PM_QUOTA'] = 'PM Quota';
$lang['USER_UPLOAD_QUOTA_REACHED'] = 'Sorry, you have reached your maximum Upload Quota Limit of %d %s'; // replace %d with Size, %s with Size Lang (MB for example)
// User Attachment Control Panel
$lang['USER_ACP_TITLE'] = 'User ACP';
$lang['UACP'] = 'User Attachment Control Panel';
$lang['USER_UPLOADED_PROFILE'] = 'Uploaded: %s';
$lang['USER_QUOTA_PROFILE'] = 'Quota: %s';
$lang['UPLOAD_PERCENT_PROFILE'] = '%d%% of total';
// Common Variables
$lang['BYTES'] = 'Bytes';

View file

@ -553,8 +553,6 @@ $lang['OCCUPATION'] = 'Род занятий';
$lang['POSTER_RANK'] = 'Звание';
$lang['TOTAL_POSTS'] = 'Всего сообщений';
$lang['USER_POST_PCT_STATS'] = '%.2f%% от общего числа'; // 15% of total
$lang['USER_POST_DAY_STATS'] = '%.2f сообщений в день'; // 1.5 posts per day
$lang['SEARCH_USER_POSTS'] = 'Найти сообщения'; // Find all posts by username
$lang['SEARCH_USER_POSTS_SHORT'] = 'Найти сообщения пользователя';
$lang['SEARCH_USER_TOPICS'] = 'Начатые темы'; // Find all topics by username
@ -1144,14 +1142,6 @@ $lang['NOTE_USER_EMPTY_GROUP_PERMISSIONS'] = 'ВНИМАНИЕ:<br />Вы мож
// Quota Variables
$lang['UPLOAD_QUOTA'] = 'Квота';
$lang['PM_QUOTA'] = 'Квота ЛС';
$lang['USER_UPLOAD_QUOTA_REACHED'] = 'К сожалению, вы достигли максимального общего объема закачанных файлов - %d %s'; // replace %d with Size, %s with Size Lang (MB for example)
// User Attachment Control Panel
$lang['USER_ACP_TITLE'] = 'Управление вложениями';//'Панель управления вложениями пользователя';
$lang['UACP'] = 'Управление вложениями';
$lang['USER_UPLOADED_PROFILE'] = 'Закачано: %s';
$lang['USER_QUOTA_PROFILE'] = 'Квота: %s';
$lang['UPLOAD_PERCENT_PROFILE'] = '%d%% от общего';
// Common Variables
$lang['BYTES'] = 'Байт';

View file

@ -152,7 +152,7 @@ $template->assign_vars(array(
));
// per-letter selection end
$sql = "SELECT username, user_id, user_opt, user_posts, user_regdate, user_from, user_website, user_email, user_avatar, user_avatar_type
$sql = "SELECT username, user_id, user_opt, user_posts, user_regdate, user_from, user_website, user_email
FROM ". BB_USERS ."
WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")";
if ( $username )
@ -173,15 +173,11 @@ if ( $row = DB()->sql_fetchrow($result) )
$username = $row['username'];
$user_id = $row['user_id'];
$from = $row['user_from'];
$joined = bb_date($row['user_regdate'], $lang['DATE_FORMAT']);
$posts = $row['user_posts'];
$poster_avatar = get_avatar($row['user_avatar'], $row['user_avatar_type'], !bf($row['user_opt'], 'user_opt', 'allow_avatar'));
$pm = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="'. append_sid("privmsg.php?mode=post&amp;". POST_USERS_URL ."=$user_id") .'">'. $lang['SEND_PM_TXTB'] .'</a>' : '<a href="' . append_sid("privmsg.php?mode=post&amp;". POST_USERS_URL ."=$user_id") .'"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
if (bf($row['user_opt'], 'user_opt', 'viewemail') || IS_ADMIN)
if (bf($row['user_opt'], 'user_opt', 'viewemail') || IS_AM)
{
$email_uri = ($bb_cfg['board_email_form']) ? append_sid("profile.php?mode=email&amp;". POST_USERS_URL ."=$user_id") : 'mailto:'. $row['user_email'];
$email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>';
@ -200,12 +196,7 @@ if ( $row = DB()->sql_fetchrow($result) )
$www = '';
}
$temp_url = append_sid("search.php?search_author=1&amp;uid=$user_id");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['SEARCH_USER_POSTS'] . '" title="' . $lang['SEARCH_USER_POSTS'] . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . $lang['SEARCH_USER_POSTS'] . '</a>';
$row_class = !($i % 2) ? 'row1' : 'row2';
$template->assign_block_vars('memberrow', array(
'ROW_NUMBER' => $i + ( $start + 1 ),
'ROW_CLASS' => $row_class,
@ -214,10 +205,7 @@ if ( $row = DB()->sql_fetchrow($result) )
'JOINED_RAW' => $row['user_regdate'],
'JOINED' => $joined,
'POSTS' => $posts,
'AVATAR_IMG' => $poster_avatar,
'SEARCH' => $search,
'PM' => $pm,
'U_SEARCH_USER' => append_sid("search.php?mode=searchuser"),
'EMAIL' => $email,
'WWW' => $www,
'U_VIEWPROFILE' => append_sid("profile.php?mode=viewprofile&amp;". POST_USERS_URL ."=$user_id"))

View file

@ -42,10 +42,6 @@ switch ($mode)
require(INC_DIR .'ucp/usercp_email.php');
break;
case 'attachcp':
require(INC_DIR .'ucp/usercp_attachcp.php');
break;
default:
bb_die('Invalid mode');
}

View file

@ -488,8 +488,8 @@ table.smilies td { padding: 3px; text-align: center; }
TopMenu, Quick Login, PM Info, Loguot..
* ---------------------------------- */
.topmenu {
background: #EFEFEF; border: solid #CFD4D8; border-width: 1px 0px;
margin: 3px 4px 0; padding: 0 8px; overflow: hidden;
background: #EFEFEF; border: 1px solid #CFD4D8;
margin: 3px 4px 0; padding: 0 3px; overflow: hidden;
}
.topmenu a:link, .topmenu a:visited { text-decoration: none; }
.topmenu td { padding: 4px; font-size: 11px; white-space: nowrap; }

View file

@ -232,7 +232,7 @@ $(document).ready(function(){
<b>{POSTS}</b>&nbsp;
[ <a href="{U_SEARCH_USER}" class="med">{L_SEARCH_USER_POSTS}</a> ]
[ <a href="{U_SEARCH_TOPICS}" class="med">{L_SEARCH_USER_TOPICS}</a> ]
<!-- IF RELEASED -->[ <a class="med" href={U_SEARCH_RELEASES}>{L_SEARCH_RELEASES}</a> ]<!-- ENDIF -->
[ <a class="med" href={U_SEARCH_RELEASES}>{L_SEARCH_RELEASES}</a> ]
</p>
</td>
</tr>

View file

@ -14,7 +14,7 @@
<!-- BEGIN reg_user_row -->
<tr class="{reg_user_row.ROW_CLASS}">
<td><a href="{reg_user_row.U_USER_PROFILE}" class="gen">{reg_user_row.USERNAME}</a></td>
<td class="tCenter">{reg_user_row.LASTUPDATE}</td>
<td class="tCenter"><u>{reg_user_row.LASTUPDATE_RAW}</u>{reg_user_row.LASTUPDATE}</td>
<!-- IF IS_ADMIN --><td class="tCenter"><a href="{reg_user_row.U_WHOIS_IP}" class="gen" target="_blank">{reg_user_row.USERIP}</a></td><!-- ENDIF -->
</tr>
<!-- END reg_user_row -->

View file

@ -114,6 +114,7 @@ while ( $row = DB()->sql_fetchrow($result) )
'ROW_CLASS' => $row_class,
'USERNAME' => $username,
'LASTUPDATE' => bb_date($row['session_time']),
'LASTUPDATE_RAW' => $row['session_time'],
'USERIP' => $user_ip,
'U_WHOIS_IP' => "http://ip-whois.net/ip_geo.php?ip=$user_ip",
'U_USER_PROFILE' => ((isset($user_id)) ? append_sid("profile.php?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $user_id) : ''),