Изменяем ссылку на профиль в DLE
По умолчанию в DLE ссылка на профиль пользователя имеет такой вид: http://сайт.ру/user/пользователь. Хак позволяет изменить ссылку на профиль: http://сайт.ру/пользователь. Поддержка без ЧПУ.
Установка:
1. Открыть файл /engine/engine.php и после строки:
} elseif ($subaction == 'userinfo') {
Вставить:
} elseif ($subaction == 'profile') {
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$user=$member_id['name'];
$url_page = $config['http_home_url'] . "user/" . urlencode ( $user );
$user_query = "subaction=userinfo&user=" . urlencode ( $user );
if (isset ( $_SESSION['dle_sort_userinfo'] )) $news_sort_by = $_SESSION['dle_sort_userinfo'];
if (isset ( $_SESSION['dle_direction_userinfo'] )) $news_direction_by = $_SESSION['dle_direction_userinfo'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_rate, approve, fixed, rating, vote_num, news_read, flag, editdate, editor, reason, view_edit, tags FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0' ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0'";
$allow_active_news = true;
$config['allow_cache'] = false;
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$user=$member_id['name'];
$url_page = $config['http_home_url'] . "user/" . urlencode ( $user );
$user_query = "subaction=userinfo&user=" . urlencode ( $user );
if (isset ( $_SESSION['dle_sort_userinfo'] )) $news_sort_by = $_SESSION['dle_sort_userinfo'];
if (isset ( $_SESSION['dle_direction_userinfo'] )) $news_direction_by = $_SESSION['dle_direction_userinfo'];
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_rate, approve, fixed, rating, vote_num, news_read, flag, editdate, editor, reason, view_edit, tags FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0' ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0'";
$allow_active_news = true;
$config['allow_cache'] = false;
Перед строкой:
if ($subaction == 'userinfo') {
Вставить:
if ($subaction == 'profile') {
$user=$member_id['name'];
$allow_userinfo = TRUE;
include_once (ENGINE_DIR . '/modules/profile.php');
} else {
$allow_active_news = TRUE;
}
$user=$member_id['name'];
$allow_userinfo = TRUE;
include_once (ENGINE_DIR . '/modules/profile.php');
} else {
$allow_active_news = TRUE;
}
2. Открыть файл .htaccess и после строки:
# вывод для отдельного юзера
Вставить:
RewriteRule ^profile(/?)+$ index.php?subaction=profile [L]