mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Реформат в PSR-2 + добавление заголовков лицензии MIT в файлы
This commit is contained in:
parent
a04df19607
commit
3730bed000
207 changed files with 44327 additions and 43119 deletions
|
@ -1,47 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!defined('IN_FORUM')) die('Hacking attempt');
|
||||
if (!defined('IN_FORUM')) {
|
||||
die('Hacking attempt');
|
||||
}
|
||||
|
||||
if (empty($_GET['u']) || empty($_GET['act_key']))
|
||||
{
|
||||
bb_die('Bad request');
|
||||
if (empty($_GET['u']) || empty($_GET['act_key'])) {
|
||||
bb_die('Bad request');
|
||||
}
|
||||
|
||||
$sql = "SELECT user_active, user_id, username, user_email, user_newpasswd, user_lang, user_actkey
|
||||
FROM " . BB_USERS . "
|
||||
WHERE user_id = " . intval($_GET[POST_USERS_URL]);
|
||||
if (!($result = DB()->sql_query($sql)))
|
||||
{
|
||||
bb_die('Could not obtain user information');
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain user information');
|
||||
}
|
||||
|
||||
if ($row = DB()->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['user_active'] && trim($row['user_actkey']) == '')
|
||||
{
|
||||
bb_die($lang['ALREADY_ACTIVATED']);
|
||||
}
|
||||
else if ((trim($row['user_actkey']) == trim($_GET['act_key'])) && (trim($row['user_actkey']) != ''))
|
||||
{
|
||||
$sql_update_pass = ( $row['user_newpasswd'] != '' ) ? ", user_password = '" . md5(md5($row['user_newpasswd'])) . "', user_newpasswd = ''" : '';
|
||||
if ($row = DB()->sql_fetchrow($result)) {
|
||||
if ($row['user_active'] && trim($row['user_actkey']) == '') {
|
||||
bb_die($lang['ALREADY_ACTIVATED']);
|
||||
} elseif ((trim($row['user_actkey']) == trim($_GET['act_key'])) && (trim($row['user_actkey']) != '')) {
|
||||
$sql_update_pass = ($row['user_newpasswd'] != '') ? ", user_password = '" . md5(md5($row['user_newpasswd'])) . "', user_newpasswd = ''" : '';
|
||||
|
||||
$sql = "UPDATE " . BB_USERS . "
|
||||
$sql = "UPDATE " . BB_USERS . "
|
||||
SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
|
||||
WHERE user_id = " . $row['user_id'];
|
||||
if (!($result = DB()->sql_query($sql)))
|
||||
{
|
||||
bb_die('Could not update users table');
|
||||
}
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not update users table');
|
||||
}
|
||||
|
||||
$message = ( $sql_update_pass == '' ) ? $lang['ACCOUNT_ACTIVE'] : $lang['PASSWORD_ACTIVATED'];
|
||||
bb_die($message);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die($lang['WRONG_ACTIVATION']);
|
||||
}
|
||||
$message = ($sql_update_pass == '') ? $lang['ACCOUNT_ACTIVE'] : $lang['PASSWORD_ACTIVATED'];
|
||||
bb_die($message);
|
||||
} else {
|
||||
bb_die($lang['WRONG_ACTIVATION']);
|
||||
}
|
||||
} else {
|
||||
bb_die($lang['NO_SUCH_USER']);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die($lang['NO_SUCH_USER']);
|
||||
}
|
|
@ -1,43 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$user_id = $userdata['user_id'];
|
||||
$user_id = $userdata['user_id'];
|
||||
$user_points = $userdata['user_points'];
|
||||
|
||||
if($bb_cfg['seed_bonus_enabled'] && $bb_cfg['bonus_upload'] && $bb_cfg['bonus_upload_price'])
|
||||
{
|
||||
$upload_row = unserialize($bb_cfg['bonus_upload']);
|
||||
$price_row = unserialize($bb_cfg['bonus_upload_price']);
|
||||
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['bonus_upload'] && $bb_cfg['bonus_upload_price']) {
|
||||
$upload_row = unserialize($bb_cfg['bonus_upload']);
|
||||
$price_row = unserialize($bb_cfg['bonus_upload_price']);
|
||||
} else {
|
||||
bb_die($lang['EXCHANGE_NOT']);
|
||||
}
|
||||
else bb_die($lang['EXCHANGE_NOT']);
|
||||
|
||||
if (isset($_POST['bonus_id']))
|
||||
{
|
||||
$id = (int) $_POST['bonus_id'];
|
||||
if (isset($_POST['bonus_id'])) {
|
||||
$id = (int)$_POST['bonus_id'];
|
||||
|
||||
$btu = get_bt_userdata($user_id);
|
||||
$btu = get_bt_userdata($user_id);
|
||||
|
||||
if (empty($btu))
|
||||
{
|
||||
require(INC_DIR .'functions_torrent.php');
|
||||
generate_passkey($user_id, true);
|
||||
$btu = get_bt_userdata($user_id);
|
||||
}
|
||||
if (empty($btu)) {
|
||||
require(INC_DIR . 'functions_torrent.php');
|
||||
generate_passkey($user_id, true);
|
||||
$btu = get_bt_userdata($user_id);
|
||||
}
|
||||
|
||||
$upload = $upload_row[$id]*1024*1024*1024;
|
||||
$points = $price_row[$id];
|
||||
$upload = $upload_row[$id] * 1024 * 1024 * 1024;
|
||||
$points = $price_row[$id];
|
||||
|
||||
if ($userdata['user_points'] < $points)
|
||||
{
|
||||
meta_refresh('index.php', 5);
|
||||
if ($userdata['user_points'] < $points) {
|
||||
meta_refresh('index.php', 5);
|
||||
|
||||
$message = $lang['BONUS_NOT_SUCCES'] .'<br /><br /><a href="'. BONUS_URL .'">'. $lang['BONUS_RETURN'] .'</a><br /><br /><a href="'. PROFILE_URL . $userdata['user_id'] .'">'. $lang['RETURN_PROFILE'] .'</a><br /><br />'. sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
|
||||
$message = $lang['BONUS_NOT_SUCCES'] . '<br /><br /><a href="' . BONUS_URL . '">' . $lang['BONUS_RETURN'] . '</a><br /><br /><a href="' . PROFILE_URL . $userdata['user_id'] . '">' . $lang['RETURN_PROFILE'] . '</a><br /><br />' . sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
|
||||
|
||||
bb_die($message);
|
||||
}
|
||||
bb_die($message);
|
||||
}
|
||||
|
||||
DB()->query("UPDATE ". BB_BT_USERS ." bu, ". BB_USERS ." u
|
||||
DB()->query("UPDATE " . BB_BT_USERS . " bu, " . BB_USERS . " u
|
||||
SET
|
||||
bu.u_up_total = u_up_total + $upload,
|
||||
u.user_points = u.user_points - $points
|
||||
|
@ -46,35 +68,34 @@ if (isset($_POST['bonus_id']))
|
|||
AND u.user_id = bu.user_id
|
||||
");
|
||||
|
||||
cache_rm_user_sessions($user_id);
|
||||
meta_refresh(BONUS_URL, 5);
|
||||
cache_rm_user_sessions($user_id);
|
||||
meta_refresh(BONUS_URL, 5);
|
||||
|
||||
$message = sprintf($lang['BONUS_SUCCES'], humn_size($upload_row[$id]*1024*1024*1024));
|
||||
$message .= '<br /><br /><a href="'. BONUS_URL .'">'. $lang['BONUS_RETURN'] .'</a><br /><br /><a href="'. PROFILE_URL . $userdata['user_id'] .'">'. $lang['RETURN_PROFILE'] .'</a><br /><br />'. sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
|
||||
$message = sprintf($lang['BONUS_SUCCES'], humn_size($upload_row[$id] * 1024 * 1024 * 1024));
|
||||
$message .= '<br /><br /><a href="' . BONUS_URL . '">' . $lang['BONUS_RETURN'] . '</a><br /><br /><a href="' . PROFILE_URL . $userdata['user_id'] . '">' . $lang['RETURN_PROFILE'] . '</a><br /><br />' . sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
|
||||
|
||||
bb_die($message);
|
||||
bb_die($message);
|
||||
} else {
|
||||
$template->assign_vars(array(
|
||||
'U_USER_PROFILE' => PROFILE_URL . $user_id,
|
||||
'S_MODE_ACTION' => 'profile.php?mode=bonus',
|
||||
'PAGE_TITLE' => $lang['EXCHANGE_BONUS'],
|
||||
'MY_BONUS' => sprintf($lang['MY_BONUS'], $user_points),
|
||||
));
|
||||
|
||||
foreach ($price_row as $i => $price) {
|
||||
if (!$price || !$upload_row[$i]) {
|
||||
continue;
|
||||
}
|
||||
$class = ($user_points >= $price) ? 'seed' : 'leech';
|
||||
|
||||
$template->assign_block_vars('bonus_upload', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1',
|
||||
'ID' => $i,
|
||||
'DESC' => sprintf($lang['BONUS_UPLOAD_DESC'], humn_size($upload_row[$i] * 1024 * 1024 * 1024)),
|
||||
'PRICE' => sprintf($lang['BONUS_UPLOAD_PRICE'], $class, sprintf('%.2f', $price)),
|
||||
));
|
||||
}
|
||||
|
||||
print_page('usercp_bonus.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'U_USER_PROFILE' => PROFILE_URL . $user_id,
|
||||
'S_MODE_ACTION' => 'profile.php?mode=bonus',
|
||||
'PAGE_TITLE' => $lang['EXCHANGE_BONUS'],
|
||||
'MY_BONUS' => sprintf($lang['MY_BONUS'], $user_points),
|
||||
));
|
||||
|
||||
foreach($price_row as $i => $price)
|
||||
{
|
||||
if(!$price || !$upload_row[$i]) continue;
|
||||
$class = ($user_points >= $price) ? 'seed' : 'leech';
|
||||
|
||||
$template->assign_block_vars('bonus_upload', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1',
|
||||
'ID' => $i,
|
||||
'DESC' => sprintf($lang['BONUS_UPLOAD_DESC'], humn_size($upload_row[$i]*1024*1024*1024)),
|
||||
'PRICE' => sprintf($lang['BONUS_UPLOAD_PRICE'], $class, sprintf('%.2f', $price)),
|
||||
));
|
||||
}
|
||||
|
||||
print_page('usercp_bonus.tpl');
|
||||
}
|
|
@ -1,27 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!defined('IN_FORUM')) die("Hacking attempt");
|
||||
if (!defined('IN_FORUM')) {
|
||||
die("Hacking attempt");
|
||||
}
|
||||
|
||||
// Is send through board enabled? No, return to index
|
||||
if (!$bb_cfg['board_email_form'])
|
||||
{
|
||||
redirect("index.php");
|
||||
if (!$bb_cfg['board_email_form']) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
set_die_append_msg();
|
||||
|
||||
if ( !empty($_GET[POST_USERS_URL]) || !empty($_POST[POST_USERS_URL]) )
|
||||
{
|
||||
$user_id = ( !empty($_GET[POST_USERS_URL]) ) ? intval($_GET[POST_USERS_URL]) : intval($_POST[POST_USERS_URL]);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die($lang['NO_USER_SPECIFIED']);
|
||||
if (!empty($_GET[POST_USERS_URL]) || !empty($_POST[POST_USERS_URL])) {
|
||||
$user_id = (!empty($_GET[POST_USERS_URL])) ? intval($_GET[POST_USERS_URL]) : intval($_POST[POST_USERS_URL]);
|
||||
} else {
|
||||
bb_die($lang['NO_USER_SPECIFIED']);
|
||||
}
|
||||
|
||||
if ( !$userdata['session_logged_in'] )
|
||||
{
|
||||
redirect(LOGIN_URL . "?redirect=profile.php&mode=email&" . POST_USERS_URL . "=$user_id");
|
||||
if (!$userdata['session_logged_in']) {
|
||||
redirect(LOGIN_URL . "?redirect=profile.php&mode=email&" . POST_USERS_URL . "=$user_id");
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
|
@ -31,61 +51,59 @@ $sql = "SELECT username, user_id, user_rank, user_email, user_lang
|
|||
WHERE user_id = $user_id
|
||||
";
|
||||
|
||||
if ($row = DB()->fetch_row($sql))
|
||||
{
|
||||
$username = $row['username'];
|
||||
$user_email = $row['user_email'];
|
||||
$user_lang = $row['user_lang'];
|
||||
if ($row = DB()->fetch_row($sql)) {
|
||||
$username = $row['username'];
|
||||
$user_email = $row['user_email'];
|
||||
$user_lang = $row['user_lang'];
|
||||
|
||||
if ( true || IS_ADMIN ) // TRUE instead of missing user_opt "prevent_email"
|
||||
{
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$subject = trim(html_entity_decode($_POST['subject']));
|
||||
$message = trim(html_entity_decode($_POST['message']));
|
||||
if (true || IS_ADMIN) {
|
||||
// TRUE instead of missing user_opt "prevent_email"
|
||||
|
||||
if (!$subject) $errors[] = $lang['EMPTY_SUBJECT_EMAIL'];
|
||||
if (!$message) $errors[] = $lang['EMPTY_MESSAGE_EMAIL'];
|
||||
if (isset($_POST['submit'])) {
|
||||
$subject = trim(html_entity_decode($_POST['subject']));
|
||||
$message = trim(html_entity_decode($_POST['message']));
|
||||
|
||||
if (!$errors)
|
||||
{
|
||||
require(CLASS_DIR .'emailer.php');
|
||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
||||
if (!$subject) {
|
||||
$errors[] = $lang['EMPTY_SUBJECT_EMAIL'];
|
||||
}
|
||||
if (!$message) {
|
||||
$errors[] = $lang['EMPTY_MESSAGE_EMAIL'];
|
||||
}
|
||||
|
||||
$emailer->from($userdata['username'] ." <{$userdata['user_email']}>");
|
||||
$emailer->email_address($username ." <$user_email>");
|
||||
if (!$errors) {
|
||||
require(CLASS_DIR . 'emailer.php');
|
||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
||||
|
||||
$emailer->use_template('profile_send_email', $user_lang);
|
||||
$emailer->set_subject($subject);
|
||||
$emailer->from($userdata['username'] . " <{$userdata['user_email']}>");
|
||||
$emailer->email_address($username . " <$user_email>");
|
||||
|
||||
$emailer->assign_vars(array(
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
'FROM_USERNAME' => $userdata['username'],
|
||||
'TO_USERNAME' => $username,
|
||||
'MESSAGE' => $message,
|
||||
));
|
||||
$emailer->send();
|
||||
$emailer->reset();
|
||||
$emailer->use_template('profile_send_email', $user_lang);
|
||||
$emailer->set_subject($subject);
|
||||
|
||||
bb_die($lang['EMAIL_SENT']);
|
||||
}
|
||||
}
|
||||
$emailer->assign_vars(array(
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
'FROM_USERNAME' => $userdata['username'],
|
||||
'TO_USERNAME' => $username,
|
||||
'MESSAGE' => $message,
|
||||
));
|
||||
$emailer->send();
|
||||
$emailer->reset();
|
||||
|
||||
$template->assign_vars(array(
|
||||
'USERNAME' => profile_url($row),
|
||||
'S_HIDDEN_FIELDS' => '',
|
||||
'S_POST_ACTION' => "profile.php?mode=email&" . POST_USERS_URL . "=$user_id",
|
||||
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
|
||||
));
|
||||
bb_die($lang['EMAIL_SENT']);
|
||||
}
|
||||
}
|
||||
|
||||
print_page('usercp_email.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die($lang['USER_PREVENT_EMAIL']);
|
||||
}
|
||||
$template->assign_vars(array(
|
||||
'USERNAME' => profile_url($row),
|
||||
'S_HIDDEN_FIELDS' => '',
|
||||
'S_POST_ACTION' => "profile.php?mode=email&" . POST_USERS_URL . "=$user_id",
|
||||
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
|
||||
));
|
||||
|
||||
print_page('usercp_email.tpl');
|
||||
} else {
|
||||
bb_die($lang['USER_PREVENT_EMAIL']);
|
||||
}
|
||||
} else {
|
||||
bb_die($lang['USER_NOT_EXIST']);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die($lang['USER_NOT_EXIST']);
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,85 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!defined('IN_FORUM')) die("Hacking attempt");
|
||||
if (!defined('IN_FORUM')) {
|
||||
die("Hacking attempt");
|
||||
}
|
||||
|
||||
set_die_append_msg();
|
||||
|
||||
if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']);
|
||||
if ($bb_cfg['emailer_disabled']) {
|
||||
bb_die($lang['EMAILER_DISABLED']);
|
||||
}
|
||||
|
||||
$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
if ($need_captcha && !bb_captcha('check')) bb_die($lang['CAPTCHA_WRONG']);
|
||||
$email = (!empty($_POST['email'])) ? trim(strip_tags(htmlspecialchars($_POST['email']))) : '';
|
||||
$sql = "SELECT * FROM " . BB_USERS . " WHERE user_email = '" . DB()->escape($email)."'";
|
||||
if ($result = DB()->sql_query($sql))
|
||||
{
|
||||
if ( $row = DB()->sql_fetchrow($result) )
|
||||
{
|
||||
if (!$row['user_active'])
|
||||
{
|
||||
bb_die($lang['NO_SEND_ACCOUNT_INACTIVE']);
|
||||
}
|
||||
if (in_array($row['user_level'], array(MOD, ADMIN)))
|
||||
{
|
||||
bb_die($lang['NO_SEND_ACCOUNT']);
|
||||
}
|
||||
if (isset($_POST['submit'])) {
|
||||
if ($need_captcha && !bb_captcha('check')) {
|
||||
bb_die($lang['CAPTCHA_WRONG']);
|
||||
}
|
||||
$email = (!empty($_POST['email'])) ? trim(strip_tags(htmlspecialchars($_POST['email']))) : '';
|
||||
$sql = "SELECT * FROM " . BB_USERS . " WHERE user_email = '" . DB()->escape($email) . "'";
|
||||
if ($result = DB()->sql_query($sql)) {
|
||||
if ($row = DB()->sql_fetchrow($result)) {
|
||||
if (!$row['user_active']) {
|
||||
bb_die($lang['NO_SEND_ACCOUNT_INACTIVE']);
|
||||
}
|
||||
if (in_array($row['user_level'], array(MOD, ADMIN))) {
|
||||
bb_die($lang['NO_SEND_ACCOUNT']);
|
||||
}
|
||||
|
||||
$username = $row['username'];
|
||||
$user_id = $row['user_id'];
|
||||
$username = $row['username'];
|
||||
$user_id = $row['user_id'];
|
||||
|
||||
$user_actkey = make_rand_str(12);
|
||||
$user_password = make_rand_str(8);
|
||||
$user_actkey = make_rand_str(12);
|
||||
$user_password = make_rand_str(8);
|
||||
|
||||
$sql = "UPDATE " . BB_USERS . "
|
||||
$sql = "UPDATE " . BB_USERS . "
|
||||
SET user_newpasswd = '$user_password', user_actkey = '$user_actkey'
|
||||
WHERE user_id = " . $row['user_id'];
|
||||
if (!DB()->sql_query($sql))
|
||||
{
|
||||
bb_die('Could not update new password information');
|
||||
}
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not update new password information');
|
||||
}
|
||||
|
||||
require(CLASS_DIR .'emailer.php');
|
||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
||||
require(CLASS_DIR . 'emailer.php');
|
||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
||||
|
||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
||||
$emailer->email_address("$username <{$row['user_email']}>");
|
||||
$emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
|
||||
$emailer->email_address("$username <{$row['user_email']}>");
|
||||
|
||||
$emailer->use_template('user_activate_passwd', $row['user_lang']);
|
||||
$emailer->use_template('user_activate_passwd', $row['user_lang']);
|
||||
|
||||
$emailer->assign_vars(array(
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
'USERNAME' => $username,
|
||||
'PASSWORD' => $user_password,
|
||||
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
|
||||
));
|
||||
$emailer->send();
|
||||
$emailer->reset();
|
||||
$emailer->assign_vars(array(
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
'USERNAME' => $username,
|
||||
'PASSWORD' => $user_password,
|
||||
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
|
||||
));
|
||||
$emailer->send();
|
||||
$emailer->reset();
|
||||
|
||||
bb_die($lang['PASSWORD_UPDATED']);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die($lang['NO_EMAIL_MATCH']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bb_die('Could not obtain user information for sendpassword');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$email = $username = '';
|
||||
bb_die($lang['PASSWORD_UPDATED']);
|
||||
} else {
|
||||
bb_die($lang['NO_EMAIL_MATCH']);
|
||||
}
|
||||
} else {
|
||||
bb_die('Could not obtain user information for sendpassword');
|
||||
}
|
||||
} else {
|
||||
$email = $username = '';
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'USERNAME' => $username,
|
||||
'EMAIL' => $email,
|
||||
'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '',
|
||||
'S_HIDDEN_FIELDS' => '',
|
||||
'S_PROFILE_ACTION' => "profile.php?mode=sendpassword",
|
||||
'USERNAME' => $username,
|
||||
'EMAIL' => $email,
|
||||
'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '',
|
||||
'S_HIDDEN_FIELDS' => '',
|
||||
'S_PROFILE_ACTION' => "profile.php?mode=sendpassword",
|
||||
));
|
||||
|
||||
print_page('usercp_sendpasswd.tpl');
|
||||
print_page('usercp_sendpasswd.tpl');
|
||||
|
|
|
@ -1,11 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (empty($bb_cfg['topic_notify_enabled']))
|
||||
{
|
||||
bb_die($lang['DISABLED']);
|
||||
if (empty($bb_cfg['topic_notify_enabled'])) {
|
||||
bb_die($lang['DISABLED']);
|
||||
}
|
||||
|
||||
$page_cfg['use_tablesorter'] = true;
|
||||
$page_cfg['use_tablesorter'] = true;
|
||||
$page_cfg['include_bbcode_js'] = true;
|
||||
$tracking_topics = get_tracks('topic');
|
||||
|
||||
|
@ -13,35 +35,31 @@ $user_id = $userdata['user_id'];
|
|||
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
|
||||
$per_page = $bb_cfg['topics_per_page'];
|
||||
|
||||
if (isset($_POST['topic_id_list']))
|
||||
{
|
||||
$topic_ids = implode(",", $_POST['topic_id_list']);
|
||||
$sql = "DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id IN(". $topic_ids .") AND user_id = $user_id";
|
||||
if (!($result = DB() ->sql_query($sql)))
|
||||
{
|
||||
bb_die('Could not delete topic watch information #1');
|
||||
}
|
||||
if (isset($_POST['topic_id_list'])) {
|
||||
$topic_ids = implode(",", $_POST['topic_id_list']);
|
||||
$sql = "DELETE FROM " . BB_TOPICS_WATCH . " WHERE topic_id IN(" . $topic_ids . ") AND user_id = $user_id";
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not delete topic watch information #1');
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
|
||||
'S_FORM_ACTION' => BB_ROOT .'profile.php?mode=watch',
|
||||
'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
|
||||
'S_FORM_ACTION' => BB_ROOT . 'profile.php?mode=watch',
|
||||
));
|
||||
|
||||
$sql = "SELECT COUNT(topic_id) as watch_count FROM ". BB_TOPICS_WATCH ." WHERE user_id = $user_id";
|
||||
if ( !($result = DB() ->sql_query($sql)) )
|
||||
{
|
||||
bb_die('Could not obtain watch topic information #2');
|
||||
$sql = "SELECT COUNT(topic_id) as watch_count FROM " . BB_TOPICS_WATCH . " WHERE user_id = $user_id";
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain watch topic information #2');
|
||||
}
|
||||
$row = DB() ->sql_fetchrow($result);
|
||||
$watch_count = ( $row['watch_count'] ) ? $row['watch_count'] : 0;
|
||||
DB() ->sql_freeresult($result);
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
$watch_count = ($row['watch_count']) ? $row['watch_count'] : 0;
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($watch_count > 0)
|
||||
{
|
||||
$sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
|
||||
if ($watch_count > 0) {
|
||||
$sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
|
||||
u2.user_level as last_user_level, u2.user_rank as last_user_rank
|
||||
FROM ". BB_TOPICS_WATCH ." w, ". BB_TOPICS ." t, ". BB_USERS ." u, ". BB_FORUMS ." f, ". BB_POSTS ." p, " . BB_USERS . " u2
|
||||
FROM " . BB_TOPICS_WATCH . " w, " . BB_TOPICS . " t, " . BB_USERS . " u, " . BB_FORUMS . " f, " . BB_POSTS . " p, " . BB_USERS . " u2
|
||||
WHERE w.topic_id = t.topic_id
|
||||
AND t.forum_id = f.forum_id
|
||||
AND p.post_id = t.topic_last_post_id
|
||||
|
@ -50,51 +68,46 @@ if ($watch_count > 0)
|
|||
AND w.user_id = $user_id
|
||||
GROUP BY t.topic_last_post_time DESC
|
||||
LIMIT $start, $per_page";
|
||||
if (!($result = DB() ->sql_query($sql)))
|
||||
{
|
||||
bb_die('Could not obtain watch topic information #3');
|
||||
}
|
||||
$watch = DB() ->sql_fetchrowset($result);
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain watch topic information #3');
|
||||
}
|
||||
$watch = DB()->sql_fetchrowset($result);
|
||||
|
||||
if ($watch)
|
||||
{
|
||||
for ( $i = 0; $i < count($watch); $i++ )
|
||||
{
|
||||
$is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
|
||||
if ($watch) {
|
||||
for ($i = 0; $i < count($watch); $i++) {
|
||||
$is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
|
||||
|
||||
$template->assign_block_vars('watch', array(
|
||||
'ROW_CLASS' => ( !($i % 2) ) ? 'row1' : 'row2',
|
||||
'POST_ID' => $watch[$i]['topic_first_post_id'],
|
||||
'TOPIC_ID' => $watch[$i]['topic_id'],
|
||||
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
|
||||
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
|
||||
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
|
||||
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
|
||||
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
|
||||
'REPLIES' => $watch[$i]['topic_replies'],
|
||||
'AUTHOR' => profile_url($watch[$i]),
|
||||
'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) .'<br />'. profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
|
||||
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
|
||||
'IS_UNREAD' => $is_unread,
|
||||
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
|
||||
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
|
||||
));
|
||||
}
|
||||
$template->assign_block_vars('watch', array(
|
||||
'ROW_CLASS' => (!($i % 2)) ? 'row1' : 'row2',
|
||||
'POST_ID' => $watch[$i]['topic_first_post_id'],
|
||||
'TOPIC_ID' => $watch[$i]['topic_id'],
|
||||
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
|
||||
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
|
||||
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
|
||||
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
|
||||
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
|
||||
'REPLIES' => $watch[$i]['topic_replies'],
|
||||
'AUTHOR' => profile_url($watch[$i]),
|
||||
'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) . '<br />' . profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
|
||||
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
|
||||
'IS_UNREAD' => $is_unread,
|
||||
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
|
||||
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
|
||||
'PAGINATION' => generate_pagination(BB_ROOT .'profile.php?mode=watch', $watch_count, $per_page, $start),
|
||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $per_page ) + 1 ), ceil( $watch_count / $per_page )),
|
||||
'U_PER_PAGE' => BB_ROOT .'profile.php?mode=watch',
|
||||
'PER_PAGE' => $per_page,
|
||||
));
|
||||
}
|
||||
DB() ->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_refresh('index.php', 3);
|
||||
bb_die($lang['NO_WATCHED_TOPICS']);
|
||||
$template->assign_vars(array(
|
||||
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
|
||||
'PAGINATION' => generate_pagination(BB_ROOT . 'profile.php?mode=watch', $watch_count, $per_page, $start),
|
||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start / $per_page) + 1), ceil($watch_count / $per_page)),
|
||||
'U_PER_PAGE' => BB_ROOT . 'profile.php?mode=watch',
|
||||
'PER_PAGE' => $per_page,
|
||||
));
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
} else {
|
||||
meta_refresh('index.php', 3);
|
||||
bb_die($lang['NO_WATCHED_TOPICS']);
|
||||
}
|
||||
|
||||
print_page('usercp_topic_watch.tpl');
|
||||
print_page('usercp_topic_watch.tpl');
|
||||
|
|
|
@ -1,58 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
require(INC_DIR .'bbcode.php');
|
||||
require(INC_DIR . 'bbcode.php');
|
||||
|
||||
$datastore->enqueue(array(
|
||||
'ranks',
|
||||
'ranks',
|
||||
));
|
||||
|
||||
if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == GUEST_UID)
|
||||
{
|
||||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == GUEST_UID) {
|
||||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
if (!$profiledata = get_userdata($_GET[POST_USERS_URL]))
|
||||
{
|
||||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
if (!$profiledata = get_userdata($_GET[POST_USERS_URL])) {
|
||||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
if (!$userdata['session_logged_in'])
|
||||
{
|
||||
redirect(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}");
|
||||
if (!$userdata['session_logged_in']) {
|
||||
redirect(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}");
|
||||
}
|
||||
|
||||
if (!$ranks = $datastore->get('ranks'))
|
||||
{
|
||||
$datastore->update('ranks');
|
||||
$ranks = $datastore->get('ranks');
|
||||
if (!$ranks = $datastore->get('ranks')) {
|
||||
$datastore->update('ranks');
|
||||
$ranks = $datastore->get('ranks');
|
||||
}
|
||||
|
||||
$poster_rank = $rank_image= $rank_style = $rank_select = '';
|
||||
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" />' : '';
|
||||
$poster_rank = $ranks[$user_rank]['rank_title'];
|
||||
$rank_style = $ranks[$user_rank]['rank_style'];
|
||||
$poster_rank = $rank_image = $rank_style = $rank_select = '';
|
||||
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" />' : '';
|
||||
$poster_rank = $ranks[$user_rank]['rank_title'];
|
||||
$rank_style = $ranks[$user_rank]['rank_style'];
|
||||
}
|
||||
if (IS_ADMIN)
|
||||
{
|
||||
$rank_select = array($lang['NONE'] => 0);
|
||||
foreach ($ranks as $row)
|
||||
{
|
||||
$rank_select[$row['rank_title']] = $row['rank_id'];
|
||||
}
|
||||
$rank_select = build_select('rank-sel', $rank_select, $user_rank);
|
||||
if (IS_ADMIN) {
|
||||
$rank_select = array($lang['NONE'] => 0);
|
||||
foreach ($ranks as $row) {
|
||||
$rank_select[$row['rank_title']] = $row['rank_id'];
|
||||
}
|
||||
$rank_select = build_select('rank-sel', $rank_select, $user_rank);
|
||||
}
|
||||
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM)
|
||||
{
|
||||
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&'. POST_USERS_URL .'='. $profiledata['user_id'] : 'mailto:'. $profiledata['user_email'];
|
||||
$email = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$email = '';
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM) {
|
||||
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
|
||||
$email = '<a class="editable" href="' . $email_uri . '">' . $profiledata['user_email'] . '</a>';
|
||||
} else {
|
||||
$email = '';
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -63,161 +78,160 @@ $profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
|
|||
|
||||
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
|
||||
|
||||
if(bf($profiledata['user_opt'], 'user_opt', 'dis_sig'))
|
||||
{
|
||||
if($profile_user_id)
|
||||
{
|
||||
$signature = $lang['SIGNATURE_DISABLE'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$signature = '';
|
||||
}
|
||||
}
|
||||
else if ($signature)
|
||||
{
|
||||
$signature = bbcode2html($signature);
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
|
||||
if ($profile_user_id) {
|
||||
$signature = $lang['SIGNATURE_DISABLE'];
|
||||
} else {
|
||||
$signature = '';
|
||||
}
|
||||
} elseif ($signature) {
|
||||
$signature = bbcode2html($signature);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||
'USERNAME' => $profiledata['username'],
|
||||
'PROFILE_USER_ID' => $profiledata['user_id'],
|
||||
'PROFILE_USER' => $profile_user_id,
|
||||
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
|
||||
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">". $poster_rank ."</span>" : $lang['USER'],
|
||||
'RANK_IMAGE' => $rank_image,
|
||||
'RANK_SELECT' => $rank_select,
|
||||
'POSTS' => $profiledata['user_posts'],
|
||||
'PM' => '<a href="' . PM_URL . '?mode=post&'. POST_USERS_URL .'='. $profiledata['user_id'] .'">'. $lang['SEND_PRIVATE_MESSAGE'] .'</a>',
|
||||
'EMAIL' => $email,
|
||||
'WWW' => $profiledata['user_website'],
|
||||
'ICQ' => $profiledata['user_icq'],
|
||||
'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'],
|
||||
'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'],
|
||||
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||
'USERNAME' => $profiledata['username'],
|
||||
'PROFILE_USER_ID' => $profiledata['user_id'],
|
||||
'PROFILE_USER' => $profile_user_id,
|
||||
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
|
||||
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">" . $poster_rank . "</span>" : $lang['USER'],
|
||||
'RANK_IMAGE' => $rank_image,
|
||||
'RANK_SELECT' => $rank_select,
|
||||
'POSTS' => $profiledata['user_posts'],
|
||||
'PM' => '<a href="' . PM_URL . '?mode=post&' . POST_USERS_URL . '=' . $profiledata['user_id'] . '">' . $lang['SEND_PRIVATE_MESSAGE'] . '</a>',
|
||||
'EMAIL' => $email,
|
||||
'WWW' => $profiledata['user_website'],
|
||||
'ICQ' => $profiledata['user_icq'],
|
||||
'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'],
|
||||
'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'],
|
||||
|
||||
'USER_ACTIVE' => $profiledata['user_active'],
|
||||
'LOCATION' => $profiledata['user_from'],
|
||||
'OCCUPATION' => $profiledata['user_occ'],
|
||||
'INTERESTS' => $profiledata['user_interests'],
|
||||
'SKYPE' => $profiledata['user_skype'],
|
||||
'TWITTER' => $profiledata['user_twitter'],
|
||||
'USER_POINTS' => $profiledata['user_points'],
|
||||
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
||||
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
|
||||
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
|
||||
'USER_ACTIVE' => $profiledata['user_active'],
|
||||
'LOCATION' => $profiledata['user_from'],
|
||||
'OCCUPATION' => $profiledata['user_occ'],
|
||||
'INTERESTS' => $profiledata['user_interests'],
|
||||
'SKYPE' => $profiledata['user_skype'],
|
||||
'TWITTER' => $profiledata['user_twitter'],
|
||||
'USER_POINTS' => $profiledata['user_points'],
|
||||
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
||||
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
|
||||
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
|
||||
|
||||
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
|
||||
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
|
||||
|
||||
'U_SEARCH_USER' => "search.php?search_author=1&uid={$profiledata['user_id']}",
|
||||
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&myt=1",
|
||||
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
|
||||
'U_SEARCH_USER' => "search.php?search_author=1&uid={$profiledata['user_id']}",
|
||||
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&myt=1",
|
||||
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
|
||||
|
||||
'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')),
|
||||
'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')),
|
||||
|
||||
'SIGNATURE' => $signature,
|
||||
'SHOW_PASSKEY' => (IS_ADMIN || $profile_user_id),
|
||||
'SHOW_ROLE' => (IS_AM || $profile_user_id || $profiledata['user_active']),
|
||||
'GROUP_MEMBERSHIP' => false,
|
||||
'TRAF_STATS' => !(IS_AM || $profile_user_id),
|
||||
'SIGNATURE' => $signature,
|
||||
'SHOW_PASSKEY' => (IS_ADMIN || $profile_user_id),
|
||||
'SHOW_ROLE' => (IS_AM || $profile_user_id || $profiledata['user_active']),
|
||||
'GROUP_MEMBERSHIP' => false,
|
||||
'TRAF_STATS' => !(IS_AM || $profile_user_id),
|
||||
));
|
||||
|
||||
if (IS_ADMIN)
|
||||
{
|
||||
$group_membership = array();
|
||||
$sql = "
|
||||
if (IS_ADMIN) {
|
||||
$group_membership = array();
|
||||
$sql = "
|
||||
SELECT COUNT(g.group_id) AS groups_cnt, g.group_single_user, ug.user_pending
|
||||
FROM ". BB_USER_GROUP ." ug
|
||||
LEFT JOIN ". BB_GROUPS ." g USING(group_id)
|
||||
FROM " . BB_USER_GROUP . " ug
|
||||
LEFT JOIN " . BB_GROUPS . " g USING(group_id)
|
||||
WHERE ug.user_id = {$profiledata['user_id']}
|
||||
GROUP BY ug.user_id, g.group_single_user, ug.user_pending
|
||||
ORDER BY NULL
|
||||
";
|
||||
if ($rowset = DB()->fetch_rowset($sql))
|
||||
{
|
||||
$member = $pending = $single = 0;
|
||||
foreach ($rowset as $row)
|
||||
{
|
||||
if (!$row['group_single_user'] && !$row['user_pending'])
|
||||
{
|
||||
$member = $row['groups_cnt'];
|
||||
}
|
||||
else if (!$row['group_single_user'] && $row['user_pending'])
|
||||
{
|
||||
$pending = $row['groups_cnt'];
|
||||
}
|
||||
else if ($row['group_single_user'])
|
||||
{
|
||||
$single = $row['groups_cnt'];
|
||||
}
|
||||
}
|
||||
if ($member) $group_membership[] = $lang['PARTY'] ." <b>$member</b>";
|
||||
if ($pending) $group_membership[] = $lang['CANDIDATE'] ." <b>$pending</b>";
|
||||
if ($single) $group_membership[] = $lang['INDIVIDUAL'];
|
||||
$group_membership = join(', ', $group_membership);
|
||||
}
|
||||
$template->assign_vars(array(
|
||||
'GROUP_MEMBERSHIP' => (bool) $group_membership,
|
||||
'GROUP_MEMBERSHIP_TXT' => $group_membership,
|
||||
));
|
||||
}
|
||||
else if (IS_MOD)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'SHOW_GROUP_MEMBERSHIP' => ($profiledata['user_level'] != USER),
|
||||
));
|
||||
if ($rowset = DB()->fetch_rowset($sql)) {
|
||||
$member = $pending = $single = 0;
|
||||
foreach ($rowset as $row) {
|
||||
if (!$row['group_single_user'] && !$row['user_pending']) {
|
||||
$member = $row['groups_cnt'];
|
||||
} elseif (!$row['group_single_user'] && $row['user_pending']) {
|
||||
$pending = $row['groups_cnt'];
|
||||
} elseif ($row['group_single_user']) {
|
||||
$single = $row['groups_cnt'];
|
||||
}
|
||||
}
|
||||
if ($member) {
|
||||
$group_membership[] = $lang['PARTY'] . " <b>$member</b>";
|
||||
}
|
||||
if ($pending) {
|
||||
$group_membership[] = $lang['CANDIDATE'] . " <b>$pending</b>";
|
||||
}
|
||||
if ($single) {
|
||||
$group_membership[] = $lang['INDIVIDUAL'];
|
||||
}
|
||||
$group_membership = join(', ', $group_membership);
|
||||
}
|
||||
$template->assign_vars(array(
|
||||
'GROUP_MEMBERSHIP' => (bool)$group_membership,
|
||||
'GROUP_MEMBERSHIP_TXT' => $group_membership,
|
||||
));
|
||||
} elseif (IS_MOD) {
|
||||
$template->assign_vars(array(
|
||||
'SHOW_GROUP_MEMBERSHIP' => ($profiledata['user_level'] != USER),
|
||||
));
|
||||
}
|
||||
|
||||
// Show users torrent-profile
|
||||
if (IS_AM || $profile_user_id || !bf($profiledata['user_opt'], 'user_opt', 'user_dls'))
|
||||
{
|
||||
require(UCP_DIR .'viewtorrent.php');
|
||||
if (IS_AM || $profile_user_id || !bf($profiledata['user_opt'], 'user_opt', 'user_dls')) {
|
||||
require(UCP_DIR . 'viewtorrent.php');
|
||||
}
|
||||
|
||||
// Ajax bt_userdata
|
||||
if (IS_AM || $profile_user_id)
|
||||
{
|
||||
show_bt_userdata($profiledata['user_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'DOWN_TOTAL_BYTES' => false,
|
||||
'MIN_DL_BYTES' => false,
|
||||
));
|
||||
if (IS_AM || $profile_user_id) {
|
||||
show_bt_userdata($profiledata['user_id']);
|
||||
} else {
|
||||
$template->assign_vars(array(
|
||||
'DOWN_TOTAL_BYTES' => false,
|
||||
'MIN_DL_BYTES' => false,
|
||||
));
|
||||
}
|
||||
|
||||
if (IS_ADMIN)
|
||||
{
|
||||
$ajax_user_opt = Zend\Json\Json::encode(array(
|
||||
'dis_avatar' => bf($profiledata['user_opt'], 'user_opt', 'dis_avatar'),
|
||||
'dis_sig' => bf($profiledata['user_opt'], 'user_opt', 'dis_sig'),
|
||||
'dis_passkey' => bf($profiledata['user_opt'], 'user_opt', 'dis_passkey'),
|
||||
'dis_pm' => bf($profiledata['user_opt'], 'user_opt', 'dis_pm'),
|
||||
'dis_post' => bf($profiledata['user_opt'], 'user_opt', 'dis_post'),
|
||||
'dis_post_edit' => bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit'),
|
||||
'dis_topic' => bf($profiledata['user_opt'], 'user_opt', 'dis_topic'),
|
||||
));
|
||||
if (IS_ADMIN) {
|
||||
$ajax_user_opt = Zend\Json\Json::encode(array(
|
||||
'dis_avatar' => bf($profiledata['user_opt'], 'user_opt', 'dis_avatar'),
|
||||
'dis_sig' => bf($profiledata['user_opt'], 'user_opt', 'dis_sig'),
|
||||
'dis_passkey' => bf($profiledata['user_opt'], 'user_opt', 'dis_passkey'),
|
||||
'dis_pm' => bf($profiledata['user_opt'], 'user_opt', 'dis_pm'),
|
||||
'dis_post' => bf($profiledata['user_opt'], 'user_opt', 'dis_post'),
|
||||
'dis_post_edit' => bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit'),
|
||||
'dis_topic' => bf($profiledata['user_opt'], 'user_opt', 'dis_topic'),
|
||||
));
|
||||
|
||||
$template->assign_vars(array(
|
||||
'EDITABLE_TPLS' => true,
|
||||
'AJAX_USER_OPT' => $ajax_user_opt,
|
||||
'U_MANAGE' => "profile.php?mode=editprofile&u={$profiledata['user_id']}",
|
||||
'U_PERMISSIONS' => "admin/admin_ug_auth.php?mode=user&u={$profiledata['user_id']}",
|
||||
));
|
||||
$template->assign_vars(array(
|
||||
'EDITABLE_TPLS' => true,
|
||||
'AJAX_USER_OPT' => $ajax_user_opt,
|
||||
'U_MANAGE' => "profile.php?mode=editprofile&u={$profiledata['user_id']}",
|
||||
'U_PERMISSIONS' => "admin/admin_ug_auth.php?mode=user&u={$profiledata['user_id']}",
|
||||
));
|
||||
}
|
||||
|
||||
$user_restrictions = array();
|
||||
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')) $user_restrictions[] = $lang['HIDE_AVATARS'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) $user_restrictions[] = $lang['SHOW_CAPTION'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_passkey')) $user_restrictions[] = $lang['DOWNLOAD_TORRENT'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_pm')) $user_restrictions[] = $lang['SEND_PM'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post')) $user_restrictions[] = $lang['SEND_MESSAGE'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit')) $user_restrictions[] = $lang['EDIT_POST'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_topic')) $user_restrictions[] = $lang['NEW_THREADS'];
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')) {
|
||||
$user_restrictions[] = $lang['HIDE_AVATARS'];
|
||||
}
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
|
||||
$user_restrictions[] = $lang['SHOW_CAPTION'];
|
||||
}
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_passkey')) {
|
||||
$user_restrictions[] = $lang['DOWNLOAD_TORRENT'];
|
||||
}
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_pm')) {
|
||||
$user_restrictions[] = $lang['SEND_PM'];
|
||||
}
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post')) {
|
||||
$user_restrictions[] = $lang['SEND_MESSAGE'];
|
||||
}
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_post_edit')) {
|
||||
$user_restrictions[] = $lang['EDIT_POST'];
|
||||
}
|
||||
if (bf($profiledata['user_opt'], 'user_opt', 'dis_topic')) {
|
||||
$user_restrictions[] = $lang['NEW_THREADS'];
|
||||
}
|
||||
|
||||
$template->assign_var('USER_RESTRICTIONS', join('</li><li>', $user_restrictions));
|
||||
|
||||
print_page('usercp_viewprofile.tpl');
|
||||
print_page('usercp_viewprofile.tpl');
|
||||
|
|
|
@ -1,6 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2005-2017 TorrentPier
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!defined('IN_PROFILE')) die(basename(__FILE__));
|
||||
if (!defined('IN_PROFILE')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$releasing = $seeding = $leeching = array();
|
||||
$releasing_count = $seeding_count = $leeching_count = 0;
|
||||
|
@ -17,7 +42,7 @@ $sql = DB()->fetch_rowset("
|
|||
f.forum_id, f.forum_name, t.topic_title,
|
||||
tor.tor_type, tor.size,
|
||||
sn.seeders, sn.leechers, tr.*
|
||||
FROM ". BB_FORUMS ." f, ". BB_TOPICS ." t, ". BB_BT_TRACKER ." tr, ". BB_BT_TORRENTS ." tor, ". BB_BT_TRACKER_SNAP ." sn
|
||||
FROM " . BB_FORUMS . " f, " . BB_TOPICS . " t, " . BB_BT_TRACKER . " tr, " . BB_BT_TORRENTS . " tor, " . BB_BT_TRACKER_SNAP . " sn
|
||||
WHERE tr.user_id = {$profiledata['user_id']}
|
||||
AND tr.topic_id = tor.topic_id
|
||||
AND sn.topic_id = tor.topic_id
|
||||
|
@ -28,96 +53,84 @@ $sql = DB()->fetch_rowset("
|
|||
ORDER BY f.forum_name, t.topic_title
|
||||
");
|
||||
|
||||
foreach ($sql as $rowset)
|
||||
{
|
||||
if ($rowset['releaser'])
|
||||
{
|
||||
$releasing[] = $rowset;
|
||||
}
|
||||
elseif ($rowset['seeder'])
|
||||
{
|
||||
$seeding[] = $rowset;
|
||||
}
|
||||
else
|
||||
{
|
||||
$leeching[] = $rowset;
|
||||
}
|
||||
foreach ($sql as $rowset) {
|
||||
if ($rowset['releaser']) {
|
||||
$releasing[] = $rowset;
|
||||
} elseif ($rowset['seeder']) {
|
||||
$seeding[] = $rowset;
|
||||
} else {
|
||||
$leeching[] = $rowset;
|
||||
}
|
||||
}
|
||||
|
||||
if ($releasing)
|
||||
{
|
||||
foreach ($releasing as $i => $row)
|
||||
{
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
if ($releasing) {
|
||||
foreach ($releasing as $i => $row) {
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
|
||||
$template->assign_block_vars('released', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||
'FORUM_NAME' => htmlCHR($row['forum_name']),
|
||||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') .'/s' : '-',
|
||||
));
|
||||
$template->assign_block_vars('released', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||
'FORUM_NAME' => htmlCHR($row['forum_name']),
|
||||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-',
|
||||
));
|
||||
|
||||
$releasing_count++;
|
||||
}
|
||||
$releasing_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($seeding)
|
||||
{
|
||||
foreach ($seeding as $i => $row)
|
||||
{
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
if ($seeding) {
|
||||
foreach ($seeding as $i => $row) {
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
|
||||
$template->assign_block_vars('seed', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||
'FORUM_NAME' => htmlCHR($row['forum_name']),
|
||||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') .'/s' : '-',
|
||||
));
|
||||
$template->assign_block_vars('seed', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||
'FORUM_NAME' => htmlCHR($row['forum_name']),
|
||||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-',
|
||||
));
|
||||
|
||||
$seeding_count++;
|
||||
}
|
||||
$seeding_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($leeching)
|
||||
{
|
||||
foreach ($leeching as $i => $row)
|
||||
{
|
||||
$compl_size = ($row['remain'] && $row['size'] && $row['size'] > $row['remain']) ? ($row['size'] - $row['remain']) : 0;
|
||||
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $row['size']) : 0;
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
if ($leeching) {
|
||||
foreach ($leeching as $i => $row) {
|
||||
$compl_size = ($row['remain'] && $row['size'] && $row['size'] > $row['remain']) ? ($row['size'] - $row['remain']) : 0;
|
||||
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $row['size']) : 0;
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
|
||||
$template->assign_block_vars('leech', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||
'FORUM_NAME' => htmlCHR($row['forum_name']),
|
||||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'COMPL_PERC' => $compl_perc,
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_DOWN' => ($row['speed_down']) ? humn_size($row['speed_down'], 0, 'KB') .'/s' : '-',
|
||||
));
|
||||
$template->assign_block_vars('leech', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||
'FORUM_NAME' => htmlCHR($row['forum_name']),
|
||||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'COMPL_PERC' => $compl_perc,
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_DOWN' => ($row['speed_down']) ? humn_size($row['speed_down'], 0, 'KB') . '/s' : '-',
|
||||
));
|
||||
|
||||
$leeching_count++;
|
||||
}
|
||||
$leeching_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'SHOW_SEARCH_DL' => IS_AM || $profile_user_id,
|
||||
'USERNAME' => $profiledata['username'],
|
||||
'L_RELEASINGS' => "{$lang['RELEASING']}: ". (($releasing_count) ? "<b>$releasing_count</b>" : '0'),
|
||||
'L_SEEDINGS' => "{$lang['SEEDING']}: ". (($seeding_count) ? "<b>$seeding_count</b>" : '0'),
|
||||
'L_LEECHINGS' => "{$lang['LEECHING']}: ". (($leeching_count) ? "<b>$leeching_count</b>" : '0'),
|
||||
'USER_DLS' => $releasing_count || $seeding_count || $leeching_count,
|
||||
));
|
||||
'SHOW_SEARCH_DL' => IS_AM || $profile_user_id,
|
||||
'USERNAME' => $profiledata['username'],
|
||||
'L_RELEASINGS' => "{$lang['RELEASING']}: " . (($releasing_count) ? "<b>$releasing_count</b>" : '0'),
|
||||
'L_SEEDINGS' => "{$lang['SEEDING']}: " . (($seeding_count) ? "<b>$seeding_count</b>" : '0'),
|
||||
'L_LEECHINGS' => "{$lang['LEECHING']}: " . (($leeching_count) ? "<b>$leeching_count</b>" : '0'),
|
||||
'USER_DLS' => $releasing_count || $seeding_count || $leeching_count,
|
||||
));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue