mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
Возможность получить старый path нахождения аттачей или аватар используя одну функцию
This commit is contained in:
parent
180f856406
commit
dd6e9aed8e
17 changed files with 113 additions and 103 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
//
|
||||
// $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $
|
||||
//
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
/**
|
||||
* Captcha
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
/**
|
||||
* Automatic correction of the language for words in the text because of the wrong keyboard layout
|
||||
* Автоматическое исправление языка для слов в тексте из-за неправильной раскладки клавиатуры
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
/**
|
||||
* A class for validating method parameters to allowed types via reflection.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
class sitemap
|
||||
{
|
||||
var $home = '';
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
/**
|
||||
* PHP5 UTF-8 is a UTF-8 aware library of functions mirroring PHP's own string functions.
|
||||
*
|
||||
|
|
|
@ -9,22 +9,25 @@ function get_path_from_id ($id, $ext_id, $base_path, $first_div, $sec_div)
|
|||
return ($base_path ? "$base_path/" : '') . floor($id/$first_div) .'/'. ($id % $sec_div) .'/'. $id . ($ext ? ".$ext" : '');
|
||||
}
|
||||
|
||||
function get_avatar_path ($id, $ext_id, $base_path = '')
|
||||
{
|
||||
return get_path_from_id($id, $ext_id, $base_path, 5000, 100);
|
||||
}
|
||||
|
||||
function delete_avatar ($user_id, $avatar_ext_id)
|
||||
{
|
||||
global $bb_cfg;
|
||||
$avatar_file = ($avatar_ext_id) ? get_avatar_path($user_id, $avatar_ext_id, $bb_cfg['avatars']['upload_path']) : '';
|
||||
$avatar_file = ($avatar_ext_id) ? get_avatar_path($user_id, $avatar_ext_id) : '';
|
||||
return ($avatar_file && file_exists($avatar_file)) ? @unlink($avatar_file) : false;
|
||||
}
|
||||
|
||||
function get_attach_path ($id)
|
||||
function get_avatar_path ($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||
{
|
||||
global $bb_cfg;
|
||||
return get_path_from_id($id, '', $bb_cfg['attach']['upload_path'], 1000, 100);
|
||||
$base_path = isset($base_path) ? $base_path : $bb_cfg['avatars']['upload_path'];
|
||||
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
||||
}
|
||||
|
||||
function get_attach_path ($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||
{
|
||||
global $bb_cfg;
|
||||
$base_path = isset($base_path) ? $base_path : $bb_cfg['attach']['upload_path'];
|
||||
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
||||
}
|
||||
|
||||
function get_tracks ($type)
|
||||
|
@ -2755,17 +2758,17 @@ function get_avatar ($user_id, $ext_id, $allow_avatar = true, $size = true, $hei
|
|||
$height = ($height != '') ? 'height="'. $height .'"' : '';
|
||||
$width = ($width != '') ? 'width="'. $width .'"' : '';
|
||||
|
||||
$user_avatar = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||
$user_avatar = '<img src="'. make_url($bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar']) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||
|
||||
if ($user_id == BOT_UID && $bb_cfg['avatars']['bot_avatar'])
|
||||
{
|
||||
$user_avatar = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['bot_avatar'] .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||
$user_avatar = '<img src="'. make_url($bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['bot_avatar']) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||
}
|
||||
elseif ($allow_avatar && $ext_id)
|
||||
else if ($allow_avatar && $ext_id)
|
||||
{
|
||||
if (file_exists($bb_cfg['avatars']['upload_path'] . get_avatar_path($user_id, $ext_id)))
|
||||
if (file_exists(get_avatar_path($user_id, $ext_id)))
|
||||
{
|
||||
$user_avatar = '<img src="'. $bb_cfg['avatars']['upload_path'] . get_avatar_path($user_id, $ext_id) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||
$user_avatar = '<img src="'. make_url(get_avatar_path($user_id, $ext_id)) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
class upload_common
|
||||
{
|
||||
var $cfg = array(
|
||||
|
@ -121,7 +123,7 @@ class upload_common
|
|||
if ($mode == 'avatar')
|
||||
{
|
||||
delete_avatar($params['user_id'], $params['avatar_ext_id']);
|
||||
$file_path = get_avatar_path($params['user_id'], $this->file_ext_id, $bb_cfg['avatars']['upload_path']);
|
||||
$file_path = get_avatar_path($params['user_id'], $this->file_ext_id);
|
||||
return $this->_move($file_path);
|
||||
}
|
||||
else if ($mode == 'attach')
|
||||
|
|
|
@ -766,14 +766,13 @@ $template->assign_vars(array(
|
|||
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], (round($bb_cfg['avatars']['max_size'] / 1024))),
|
||||
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),
|
||||
'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']),
|
||||
'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')),
|
||||
|
||||
'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], $bb_cfg['max_sig_chars']),
|
||||
'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'),
|
||||
|
||||
'PR_USER_ID' => $pr_data['user_id'],
|
||||
'U_RESET_AUTOLOGIN' => LOGIN_URL . "?logout=1&reset_autologin=1&sid={$userdata['session_id']}",
|
||||
|
||||
'AVATAR_URL_PATH' => ($pr_data['avatar_ext_id']) ? get_avatar_path($pr_data['user_id'], $pr_data['avatar_ext_id']) : '',
|
||||
));
|
||||
|
||||
print_page('usercp_register.tpl');
|
Loading…
Add table
Add a link
Reference in a new issue