mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Реформат в PSR-2 + добавление заголовков лицензии MIT в файлы
This commit is contained in:
parent
a04df19607
commit
3730bed000
207 changed files with 44327 additions and 43119 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue