Установка и обновление Модуля Files на ДЛЕ 9
1. Скопировать все файлы из папки root_dir в данном архиве на ваш сервер (так, чтобы схожие папки совпадали).
2. Установите для папки templates и всем вложенным в нее папкам права на запись (CHMOD 777)
3. Установите для всех файлов в папке templates права на запись (CHMOD 666)
4. Установите права для записи (CHMOD 777) для папки uploads, а также для всех папок, находящихся внутри них.
5. Установите права для записи (CHMOD 777) для папок /engine/data/, /engine/cache/.
6. Внесение изменений в файлы:
6.1. engine/engine.php
Найти
case "deletenews" :
include ENGINE_DIR . '/modules/deletenews.php';
break;
Добавить выше
// Модуль Files
case "files" :
include ENGINE_DIR.'/modules/files/files.php';
break;
// Модуль Files
Найти
elseif ($do == 'static') $titl_e = $static_descr;
Добавить ниже
// Модуль Files
elseif ($do == 'files' AND $op == 'addfile')
{
$nam_e = "Добавление файла в архив файлов";
}
elseif ($do == 'files')
{
if($metatags['title'] == "")
$nam_e = $titl_e = "Архив файлов ";
else
$titl_e = $metatags['title']." » Архив файлов ";
}
// Модуль Files
Найти
} elseif ($nam_e) $s_navigation .= " » " . $nam_e;
Заменить на
// Модуль Files
} elseif ($do == 'files' OR $do == 'uploader')
{
$id = intval($_REQUEST['id']);
include_once ENGINE_DIR.'/data/'.$do.'_config_global.php';
if($_REQUEST['op'] == "cat")
{
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/\">".$modultitle."</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."\">".$modultitle."</a>";
if ($cat_i_down[$id]['parentid'] != 0)
{
$parentcategory = $cat_i_down[$id]['parentid'];
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/cat".$cat_i_down[$parentcategory]['id'].".html\">{$cat_i_down[$parentcategory]['name']}</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."&op=cat&id=".$cat_i_down[$parentcategory]['id']."\">{$cat_i_down[$parentcategory]['name']}</a>";
}
$s_navigation .= " » ".$cat_i_down[$id]['name'];
} elseif($_REQUEST['op'] == "sendfriend") {
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/\">".$modultitle."</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."\">".$modultitle."</a>";
$s_navigation .= " » Отправить другу";
} elseif($_REQUEST['op'] == "options") {
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/\">".$modultitle."</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."\">".$modultitle."</a>";
$s_navigation .= " » Настройки пользователя";
} elseif($_REQUEST['op'] == "favorites") {
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/\">".$modultitle."</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."\">".$modultitle."</a>";
$s_navigation .= " » Закладки";
} else {
$fileid = intval($_REQUEST['fileid']);
if($fileid == 0)
{
$s_navigation .= " » ". $nam_e;
}
else
{
$cats = $db->super_query("SELECT `title`, `category` FROM `" . PREFIX . "_".$modul_dbtitle."` WHERE `id` = '{$fileid}'");
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/\">".$modultitle."</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."\">".$modultitle."</a>";
if ($cat_i_down[$cats['category']]['parentid'] != 0)
{
$parentcategory = $cat_i_down[$cats['category']]['parentid'];
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/cat".$cat_i_down[$parentcategory]['id'].".html\">{$cat_i_down[$parentcategory]['name']}</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."&op=cat&id=".$cat_i_down[$parentcategory]['id']."\">{$cat_i_down[$parentcategory]['name']}</a>";
}
if ($config['allow_alt_url'] == "yes")
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."".$modulname."/cat".$cat_i_down[$cats['category']]['id'].".html\">{$cat_i_down[$cats['category']]['name']}</a>";
else
$s_navigation .= " » <a class=\"file_navigation\" href=\"".$config['http_home_url']."index.php?do=".$modulname."&op=cat&id=".$cat_i_down[$cats['category']]['id']."\">{$cat_i_down[$cats['category']]['name']}</a>";
$s_navigation .= " » ".$cats['title'];
}
}
}
// Модуль Files
elseif ($nam_e) $s_navigation .= " » " . $nam_e;
Найти
if ($titl_e) $s_navigation .= " » " . $titl_e;
Заменить на
if ($titl_e AND ($do != 'files' AND $do != 'uploader')) $s_navigation .= " » ". $titl_e;
6.2. templates/Default/login.tpl
Добавить код для добавления файла
<a href="{$config['http_home_url']}index.php?do=files&op=addfile">Добавить файл</a>
Добавить код для просмотра закладок файлов
<a href="{$config['http_home_url']}index.php?do=files&op=favorites">Избранные файлы</a>
Для получения ссылки на архив добавляем ссылку вида
<a href="http://site.ru/index.php?do=files">Архив файлов</a> - без включенного ЧПУ
<a href="http://site.ru/files">Архив файлов</a> - с включенным ЧПУ
6.3. index.php
Найти
$tpl->set ( '{calendar}', $tpl->result['calendar'] );
Добавить ниже
// Моудль Files
$files = "files";
require_once ROOT_DIR.'/engine/modules/files/newfiles.php';
$tpl->set('{newfiles}',$newfiles);
require_once ROOT_DIR.'/engine/modules/files/top_downloads_files.php';
$tpl->set('{top_downloads_files}',$newfiles);
require_once ROOT_DIR.'/engine/modules/files/menu_files.php';
$tpl->set('{menu_files}',$menu_files);
$menu_files = "";
require_once ROOT_DIR.'/engine/modules/files/archives.php';
$tpl->set('{archives_files}',$files_archive);
require_once ROOT_DIR.'/engine/modules/files/block_stat.php';
$tpl->set('{block_stat}',$stats_files);
require_once ROOT_DIR.'/engine/modules/files/newfiles_bottom.php';
$tpl->set('{newfiles_bottom}',$new_bottom);
require_once ROOT_DIR.'/engine/modules/files/block_bottom.php';
$tpl->set('{block_files}',$block_files);
// Моудль Files
Найти
if ($user_group[$member_id['user_group']]['allow_all_edit']) {
$ajax .= <<<HTML
var allow_dle_delete_news = true;\n
HTML;
} else {
$ajax .= <<<HTML
var allow_dle_delete_news = false;\n
HTML;
}
Добавить ниже
// Модуль Files
include_once ENGINE_DIR.'/data/files_config_global.php';
include_once ENGINE_DIR . '/modules/files/function.php';
$cat_access_config = get_vars_files ( "", "access_config" );
if (! $cat_access_config) {
$cat_access_config = array ();
$result = $db->query ( "SELECT `param_name`, `value` FROM `" . PREFIX . "_" . $modul_dbtitle . "_access_configure`" );
while ( $row = $db->get_row ( $result ) ) {
$cat_access_config [$row ['param_name']] = array ();
$row['value'] = explode ( ',', $row['value'] );
$cat_access_config [$row ['param_name']] = $row['value'];
}
set_vars_files ( "", "access_config", $cat_access_config );
$db->free ( $result );
}
if (in_array($member_id['user_group'], $cat_access_config['access_delete_files']) OR $member_id['user_group'] == "1") {
$ajax .= <<<HTML
var allow_dle_delete_f = true;\n
HTML;
} else {
$ajax .= <<<HTML
var dle_login_hash = '';
var allow_dle_delete_f = false;\n
HTML;
}
// Модуль Files
После этого в нужном месте сайта (в шаблоне) вставить (main.tpl):
{newfiles} - для вывода последних файлов
{top_downloads_files} - для вывода популярных по скачиванию файлов
{menu_files} - автоматическое меню файлового архива (данное дополнение продается отдельно)
{archives_files} - выводит архив файлов по месяцам (как для новостей)
{block_stat} - выводит статистику добавленных файлов
{newfiles_bottom} - выводит новые файлы (исп-ся для нижней части шаблона)
{block_files} - выводит файлы, зафиксированные в блоке при добавлении.
6.4. engine/inc/usergroup.php
Найти
max_pm='$max_pm'
Заменить на
max_pm='$max_pm', speed_download_files='$speed_download_files'
Найти
if( $action == "add" ) {
Добавить ниже
// Модуль Files
$speed_download_files = "";
// Модуль Files
Найти
$group_name_value = htmlspecialchars( stripslashes( $user_group[$id]['group_name'] ) );
Добавить ниже
// Модуль Files
$speed_download_files = htmlspecialchars(stripslashes($user_group[$id]['speed_download_files']));
// Модуль Files
Найти
<a id="a" class="tab {content:'cont_1'}">{$lang['tabs_gr_all']}</a><a id="b" class="tab {content:'cont_2'}">{$lang['tabs_gr_news']}</a><a id="c" class="tab {content:'cont_3'}" >{$lang['tabs_gr_comments']}</a><a id="c" class="tab {content:'cont_4'}" >{$lang['tabs_gr_admin']}</a>
Заменить на
<a id="a" class="tab {content:'cont_1'}">{$lang['tabs_gr_all']}</a><a id="b" class="tab {content:'cont_2'}">{$lang['tabs_gr_news']}</a><a id="c" class="tab {content:'cont_3'}" >{$lang['tabs_gr_comments']}</a><a id="c" class="tab {content:'cont_4'}" >{$lang['tabs_gr_admin']}</a><a id="c" class="tab {content:'cont_5'}" >Файловый архив</a>
Найти
<tr>
<td style="padding:4px;" class="option"><b>{$lang['group_a_googlemap']}</b><br /><span class="small">{$lang['group_h_googlemap']}</span></td>
<td style="padding-top:2px;padding-bottom:2px;"><input type="radio" name="admin_googlemap" {$admin_googlemap_yes} value="1" {$gastgroup}> {$lang['opt_sys_yes']} <input type="radio" name="admin_googlemap" {$admin_googlemap_no} value="0" {$admingroup}> {$lang['opt_sys_no']}</td>
</tr>
<tr><td background="engine/skins/images/mline.gif" height=1 colspan=2></td></tr>
</table>
</div>
Добавить ниже
<!--modul-files-->
<div id="cont_5" style="display:none;">
<table width="100%">
<tr>
<td style="padding:4px;" class="option"><b>{$lang['opt_sys_file5']}</b><br /><span class="small">{$lang['opt_sys_file5d']}</span></td>
<td width="480" style="padding-top:2px;padding-bottom:2px;"><input class="edit" type="text" size="25" name="speed_download_files" value="{$speed_download_files}"></td>
</tr>
</table>
</div>
6.5. .htaccess
Найти
RewriteEngine On
Добавить ниже
# Модуль Files
RewriteRule ^files.xml$ engine/modules/files/files_rss.php?action=files
RewriteRule ^([1-9][0-9]*)_files.xml$ engine/modules/files/files_rss.php?action=files&catid=$1
RewriteRule ^files(/?)+$ index.php?do=files
RewriteRule ^files/user/(.*)(/?)+$ index.php?do=files&name=$1 [L]
# За день
RewriteRule ^files/([0-9]{4})/([0-9]{2})/([0-9]{2})(/?)+$ index.php?do=files&year=$1&month=$2&day=$3 [L]
RewriteRule ^files/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)(/?)+$ index.php?do=files&year=$1&month=$2&day=$3&cstart=$4 [L]
# За весь месяц
RewriteRule ^files/([0-9]{4})/([0-9]{2})(/?)+$ index.php?do=files&year=$1&month=$2 [L]
RewriteRule ^files/([0-9]{4})/([0-9]{2})/page/([0-9]+)(/?)+$ index.php?do=files&year=$1&month=$2&cstart=$3 [L]
# Вывод за весь год
RewriteRule ^files/([0-9]{4})(/?)+$ index.php?do=files&year=$1 [L]
RewriteRule ^files/([0-9]{4})/page/([0-9]+)(/?)+$ index.php?do=files&year=$1&cstart=$2 [L]
RewriteRule ^addfile(/?)+$ index.php?do=files&op=addfile
RewriteRule ^files/file([1-9][0-9]*).html index.php?do=files&op=download&fileid=$1
RewriteRule ^files/options.html index.php?do=files&op=options
RewriteRule ^files/([0-9]+)_(.*).html(/?)+$ index.php?do=files&op=download&fileid=$1 [L]
RewriteRule ^files/cat/([1-9][0-9]*)(/?)+$ index.php?do=files&op=cat&id=$1 [L]
RewriteRule ^files/cat/([1-9][0-9]*)/([1-9][0-9]*)(/?)+$ index.php?do=files&op=platform&id=$1&catid=$2 [L]
RewriteRule ^files/cat/([1-9][0-9]*)/([1-9][0-9]*)/page/([0-9]+)(/?)+$ index.php?do=files&op=platform&id=$1&catid=$2&cstart=$3 [L]
RewriteRule ^files/tag/([1-9][0-9]*)(/?)+$ index.php?do=files&op=platform&id=$1 [L]
RewriteRule ^files/tag/([1-9][0-9]*)/page/([0-9]+)(/?)+$ index.php?do=files&op=platform&id=$1&cstart=$2 [L]
RewriteRule ^files/version/([1-9][0-9]*)(/?)+$ index.php?do=files&op=version&id=$1 [L]
RewriteRule ^files/version/([1-9][0-9]*)/page/([0-9]+)(/?)+$ index.php?do=files&op=version&id=$1&cstart=$2 [L]
RewriteRule ^files/cat([1-9][0-9]*).html(/?)+$ index.php?do=files&op=cat&id=$1 [L]
##############Сортировка файлов#############################################################
RewriteRule ^files/cat([1-9][0-9]*)-titleA.html index.php?do=files&op=cat&id=$1&orderby=titleA
RewriteRule ^files/cat([1-9][0-9]*)-titleD.html index.php?do=files&op=cat&id=$1&orderby=titleD
RewriteRule ^files/cat([1-9][0-9]*)-dateA.html index.php?do=files&op=cat&id=$1&orderby=dateA
RewriteRule ^files/cat([1-9][0-9]*)-dateD.html index.php?do=files&op=cat&id=$1&orderby=dateD
RewriteRule ^files/cat([1-9][0-9]*)-hitsA.html index.php?do=files&op=cat&id=$1&orderby=hitsA
RewriteRule ^files/cat([1-9][0-9]*)-hitsD.html index.php?do=files&op=cat&id=$1&orderby=hitsD
##############################################################################################
RewriteRule ^files/cat([0-9][0-9]*)_(.*)-(.*).html index.php?cstart=$2&do=files&op=cat&id=$1&orderby=$3
RewriteRule ^files/comments/(.*)/file([1-9][0-9]*).html index.php?cstart=$1&do=files&op=download&fileid=$2
RewriteRule ^files/page(.*)/ index.php?cstart=$1&do=files
RewriteRule ^files/file([1-9][0-9]*)-comdel([1-9][0-9]*).html index.php?do=files&op=del&fileid=$1&id=$2
RewriteRule ^files/brokenfile_([1-9][0-9]*).html index.php?do=files&op=brokenfile&fileid=$1
# Алфавит
RewriteRule ^files/alpha/([^/]*)(/?)+$ index.php?do=files&op=alpha&word=$1 [L]
RewriteRule ^files/alpha/([^/]*)/page([0-9]+)(/?)$ index.php?do=files&op=alpha&word=$1&cstart=$2 [L]
# вывод избранных статей
RewriteRule ^favoritesfiles(/?)+$ index.php?do=files&op=favorites [L]
RewriteRule ^favoritesfiles/page/([0-9]+)(/?)+$ index.php?do=files&op=favorites&cstart=$1 [L]
# Google SiteMap
RewriteRule ^files_sitemap.xml$ uploads/files_sitemap.xml [L]
# Модуль Files
========================================================================================================================================