Перейти к публикации

хак-модуль дополнительных полей для 9.6


Рекомендованные сообщения

хак-модуль дополнительных полей для 9.6 (добовляет линки и выводит в [сортирует] в shortstory.tpl и fullstory.tpl и searchresult.tpl) а так же отабражение в фоваритах + САМОЕ ГЛАВНОЕ ВСЕ ПОЛЯ ПОПАДАЮТ В ПОИСК (ПОИСК БЫСТРЫЙ И ГЛОБАЛЬНЫЙ)

(буду честен .. писал и тестирую на пирате) ... по этому адрес не выкладываю ...

Делаем запрос...
ALTER TABLE `dle_post` ADD `year` VARCHAR( 5 ) NOT NULL ,
ADD `country` VARCHAR( 225 ) NOT NULL ,
ADD `genre` TEXT NOT NULL ,
ADD `datex` TEXT NOT NULL ,
ADD `director` TEXT NOT NULL ,
ADD `producer` TEXT NOT NULL ,
ADD `actors` TEXT NOT NULL;
======================================================
======================================================
======================================================
======================================================
======================================================
1. В корне открываем .htacess
\\\\\\\\\\находим
# Редиректы
RewriteRule ^page/(.*)$ index.php?cstart=$1 [L]
\\\\\\\\\\Ниже вставляем
# Киномод
RewriteRule ^year/([0-9]+)(/?)+$ index.php?do=year&year=$1 [L]
RewriteRule ^year/([0-9]+)/page/([0-9]+)(/?)+$ index.php?do=year&year=$1&cstart=$2 [L]
RewriteRule ^country/([^/]*)(/?)+$ index.php?do=country&country=$1 [L]
RewriteRule ^country/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=country&country=$1&cstart=$2 [L]
RewriteRule ^genre/([^/]*)(/?)+$ index.php?do=genres&genre=$1 [L]
RewriteRule ^genre/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=genres&genre=$1&cstart=$2 [L]
RewriteRule ^datex/([^/]*)(/?)+$ index.php?do=datexs&datex=$1 [L]
RewriteRule ^datex/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=datexs&datex=$1&cstart=$2 [L]
RewriteRule ^director/([^/]*)(/?)+$ index.php?do=directors&director=$1 [L]
RewriteRule ^director/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=directors&director=$1&cstart=$2 [L]
RewriteRule ^producer/([^/]*)(/?)+$ index.php?do=producers&producer=$1 [L]
RewriteRule ^producer/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=producers&producer=$1&cstart=$2 [L]
RewriteRule ^cast/([^/]*)(/?)+$ index.php?do=actors&actor=$1 [L]
RewriteRule ^cast/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=actors&actor=$1&cstart=$2 [L]
======================================================
======================================================
======================================================
======================================================
======================================================
2.Открываем engine/inc/addnews.php
\\\\\\\\\\После
<div class="hr_line"></div>
<table width="100%">
\\\\\\\\\\Добавить
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Год:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="year" id="year"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px;">число.месяц.год:</td>
<td><input class="edit" type="text" size="55" name="country" id="country"></td>
</tr>
<tr>
<td valign="top" height="29" style="padding-left:220px; border-bottom: 1px #999999 dotted;" colspan="2">Пример: <strong>07.мая.1982</strong></td>
</tr>
<tr>
<td height="29" style="padding-left:19px;" colspan="2">Все перечисления в <strong>Страна</strong>, <strong>Жанр</strong>, <strong>Режиссер</strong>, <strong>Продюсер</strong> и <strong>В ролях</strong>. через <strong>запятую</strong>, при отсутствии поставить <strong>троеточие</strong>.</td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Страна:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="datex" id="datex"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Жанр:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="genre" id="genre"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Режиссер:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="director" id="director"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Продюсер:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="producer" id="producer"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">В ролях:</td>
<td style="padding-left:2px; border-bottom: 1px #999999 dotted;"><textarea rows="10" style="width:342px;" name="actors"></textarea></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
======================================================
\\\\\\\\\\После
else $alt_name = totranslit( stripslashes( $alt_name ), true, false );
\\\\\\\\\\Добавить
$year = $_POST['year'];
$country = $_POST['country'];
$genre = $_POST['genre'];
$genrelist = explode(",", $genre);
$genre = '';
$ngenre = count($genrelist);
foreach($genrelist as $key=>$value)
{
$genre .= trim($value);
if ($key < $ngenre-1)
$genre .= "|";
}
$datex = $_POST['datex'];
$datexlist = explode(",", $datex);
$datex = '';
$ndatex = count($datexlist);
foreach($datexlist as $key=>$value)
{
$datex .= trim($value);
if ($key < $ndatex-1)
$datex .= "|";
}
$director = $_POST['director'];
$directorlist = explode(",", $director);
$director = '';
$ndirector = count($directorlist);
foreach($directorlist as $key=>$value)
{
$director .= trim($value);
if ($key < $ndirector-1)
$director .= "|";
}
$producer = $_POST['producer'];
$producerlist = explode(",", $producer);
$producer = '';
$nproducer = count($producerlist);
foreach($producerlist as $key=>$value)
{
$producer .= trim($value);
if ($key < $nproducer-1)
$producer .= "|";
}
$actors = $_POST['actors'];
$actorslist = explode(",", $actors);
$actors = '';
$nactors = count($actorslist);
foreach($actorslist as $key=>$value)
{
$actors .= trim($value);
if ($key < $nactors-1)
$actors .= "|";
}
======================================================
\\\\\\\\\\Заменить запрос
$db->query( "INSERT INTO " . PREFIX . "_post (date .......

\\\\\\\\\\на
$db->query( "INSERT INTO " . PREFIX . "_post (date, autor, short_story, full_story, xfields, title, descr, keywords, category, alt_name, allow_comm, approve, allow_main, fixed, allow_br, symbol, tags, metatitle, year, country, genre, datex, director, producer, actors) values ('$thistime', '{$member_id['name']}', '$short_story', '$full_story', '$filecontents', '$title', '{$metatags['description']}', '{$metatags['keywords']}', '$category_list', '$alt_name', '$allow_comm', '$approve', '$allow_main', '$news_fixed', '$allow_br', '$catalog_url', '{$_POST['tags']}', '{$metatags['title']}', '$year', '$country', '$genre', '$datex', '$director', '$producer', '$actors')" );
======================================================
======================================================
======================================================
======================================================
======================================================
======================================================
3. Открываем engine/inc/editnews.php
\\\\\\\\\\После
$row['metatitle'] = stripslashes( $row['metatitle'] );

\\\\\\\\\\Добавить
$country = str_replace("|", ", ", $row['country']);
$genre = str_replace("|", ", ", $row['genre']);
$datex = str_replace("|", ", ", $row['datex']);
$director = str_replace("|", ", ", $row['director']);
$producer = str_replace("|", ", ", $row['producer']);
$actors = str_replace("|", ", ", $row['actors']);
======================================================
\\\\\\\\\\После
<div class="hr_line"></div>
<table width="100%">
\\\\\\\\\\Добавить
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Год:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="year" id="year" value="{$row['year']}"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px;">число.месяц.год:</td>
<td><input class="edit" type="text" size="55" name="country" id="country" value="{$row['country']}"></td>
</tr>
<tr>
<td valign="top" height="29" style="padding-left:220px; border-bottom: 1px #999999 dotted;" colspan="2">Пример: <strong>07.мая.1982</strong></td>
</tr>
<tr>
<td height="29" style="padding-left:19px;" colspan="2">Все перечисления в <strong>Страна</strong>, <strong>Жанр</strong>, <strong>Режиссер</strong>, <strong>Продюсер</strong> и <strong>В ролях</strong>. через <strong>запятую</strong>, при отсутствии поставить <strong>троеточие</strong>.</td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Страна:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="datex" id="datex" value="{$datex}"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Жанр:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="genre" id="genre" value="{$genre}"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Режиссер:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="director" id="director" value="{$director}"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">Продюсер:</td>
<td style="border-bottom: 1px #999999 dotted;"><input class="edit" type="text" size="55" name="producer" id="producer" value="{$producer}"></td>
</tr>
<tr>
<td height="29" style="padding-left:5px; border-bottom: 1px #999999 dotted;">В ролях:</td>
<td style="padding-left:2px; border-bottom: 1px #999999 dotted;"><textarea rows="10" style="width:342px;" name="actors">{$actors}</textarea></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
======================================================
\\\\\\\\\\После
else {

$full_story = $db->safesql( $parse->BB_Parse( $full_story, false ) );
$short_story = $db->safesql( $parse->BB_Parse( $short_story, false ) );

}

\\\\\\\\\\Добавить
$year = $_POST['year'];
$country = $_POST['country'];
$genre = $_POST['genre'];
$genrelist = explode(",", $genre);
$genre = '';
$ngenre = count($genrelist);
foreach($genrelist as $key=>$value)
{
$genre .= trim($value);
if ($key < $ngenre-1)
$genre .= "|";
}
$datex = $_POST['datex'];
$datexlist = explode(",", $datex);
$datex = '';
$ndatex = count($datexlist);
foreach($datexlist as $key=>$value)
{
$datex .= trim($value);
if ($key < $ndatex-1)
$datex .= "|";
}
$director = $_POST['director'];
$directorlist = explode(",", $director);
$director = '';
$ndirector = count($directorlist);
foreach($directorlist as $key=>$value)
{
$director .= trim($value);
if ($key < $ndirector-1)
$director .= "|";
}
$producer = $_POST['producer'];
$producerlist = explode(",", $producer);
$producer = '';
$nproducer = count($producerlist);
foreach($producerlist as $key=>$value)
{
$producer .= trim($value);
if ($key < $nproducer-1)
$producer .= "|";
}
$actors = $_POST['actors'];
$actorslist = explode(",", $actors);
$actors = '';
$nactors = count($actorslist);
foreach($actorslist as $key=>$value)
{
$actors .= trim($value);
if ($key < $nactors-1)
$actors .= "|";
}
======================================================
\\\\\\\\\\Заменить

$db->query( "UPDATE " . PREFIX . "_post SET title='$title', date='$thistime', short_story='$short_story', full_story='$full_story', xfields='$filecontents', descr='{$metatags['description']}', keywords='{$metatags['keywords']}', category='$category_list', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', fixed='$news_fixed', allow_br='$allow_br', symbol='$catalog_url', tags='{$_POST['tags']}', metatitle='{$metatags['title']}' WHERE id='$item_db[0]'" );

} else {

$db->query( "UPDATE " . PREFIX . "_post SET title='$title', short_story='$short_story', full_story='$full_story', xfields='$filecontents', descr='{$metatags['description']}', keywords='{$metatags['keywords']}', category='$category_list', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', fixed='$news_fixed', allow_br='$allow_br', symbol='$catalog_url', tags='{$_POST['tags']}', metatitle='{$metatags['title']}' WHERE id='$item_db[0]'" );
}

\\\\\\\\\\На
$db->query( "UPDATE " . PREFIX . "_post SET title='$title', year='$year', country='$country', genre='$genre', datex='$datex', director='$director', producer='$producer', actors='$actors', date='$thistime', short_story='$short_story', full_story='$full_story', xfields='$filecontents', descr='{$metatags['description']}', keywords='{$metatags['keywords']}', category='$category_list', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', fixed='$news_fixed', allow_br='$allow_br', symbol='$catalog_url', tags='{$_POST['tags']}', metatitle='{$metatags['title']}' WHERE id='$item_db[0]'" );

} else {

$db->query( "UPDATE " . PREFIX . "_post SET title='$title', year='$year', country='$country', genre='$genre', datex='$datex', director='$director', producer='$producer', actors='$actors', short_story='$short_story', full_story='$full_story', xfields='$filecontents', descr='{$metatags['description']}', keywords='{$metatags['keywords']}', category='$category_list', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', fixed='$news_fixed', allow_br='$allow_br', symbol='$catalog_url', tags='{$_POST['tags']}', metatitle='{$metatags['title']}' WHERE id='$item_db[0]'" );
}
======================================================
======================================================
======================================================
======================================================
======================================================
4. Открываем engine/modules/show.short.php
\\\\\\\\\\После
$tpl->set( '{approve}', "" );
\\\\\\\\\\Добавить

$genresList = explode('|',$row['genre']);
$genres = '';
$cntGenres = count($genresList);
$ai = 0;

foreach ($genresList as $genre)
{
$ai++;
$genre = trim($genre);
$genres .= '<a href="/genre/'.urlencode(str_replace(' ','_',$genre)).'" title="'.$genre.'">'.$genre.'</a>';
if ($ai<$cntGenres) $genres .= ', ';
}
unset($genresList);

if (!empty($row['genre'])) {
$genreall= $genres;
}
$tpl->set( '{genreall}', $genreall);

$datexsList = explode('|',$row['datex']);
$datexs = '';
$cntDatexs = count($datexsList);
$ai = 0;

foreach ($datexsList as $datex)
{
$ai++;
$datex = trim($datex);
$datexs .= '<a href="/datex/'.urlencode(str_replace(' ','_',$datex)).'" title="'.$datex.'">'.$datex.'</a>';
if ($ai<$cntDatexs) $datexs .= ', ';
}
unset($datexsList);

if (!empty($row['datex'])) {
$datexall= $datexs;
}
$tpl->set( '{datexall}', $datexall);

$directorsList = explode('|',$row['director']);
$directors = '';
$cntDirectors = count($directorsList);
$ai = 0;

foreach ($directorsList as $director)
{
$ai++;
$director = trim($director);
$directors .= '<a href="/director/'.urlencode(str_replace(' ','_',$director)).'" title="'.$director.'">'.$director.'</a>';
if ($ai<$cntDirectors) $directors .= ', ';
}
unset($directorsList);

if (!empty($row['director'])) {
$directorall= $directors;
}
$tpl->set( '{directorall}', $directorall);

$producersList = explode('|',$row['producer']);
$producers = '';
$cntProducers = count($producersList);
$ai = 0;

foreach ($producersList as $producer)
{
$ai++;
$producer = trim($producer);
$producers .= '<a href="/producer/'.urlencode(str_replace(' ','_',$producer)).'" title="'.$producer.'">'.$producer.'</a>';
if ($ai<$cntProducers) $producers .= ', ';
}
unset($producersList);

if (!empty($row['producer'])) {
$producerall= $producers;
}
$tpl->set( '{producerall}', $producerall);

$actorsList = explode('|',$row['actors']);
$actors = '';
$cntActors = count($actorsList);
$ai = 0;

foreach ($actorsList as $actor)
{
$ai++;
$actor = trim($actor);
$actors .= '<a href="/cast/'.urlencode(str_replace(' ','_',$actor)).'" title="'.$actor.'">'.$actor.'</a>';
if ($ai<$cntActors) $actors .= ', ';
}
unset($actorsList);

if (!empty($row['actors'])) {
$actorall= $actors;
}
$tpl->set( '{actorall}', $actorall);

$year1 = $row['year'];
$tpl->set( '{year}', $year1!='' ? '<a href="/year/'.str_replace(' ','_',$year1).'" title="'.$year1.'">'.$year1.'</a>' : '');
$country = $row['country'];
$tpl->set( '{country}', $year1!='' ? '<a href="/country/'.urlencode(str_replace(' ','_',$country)).'" title="'.$country.'">'.$country.'</a>' : '');
======================================================
======================================================
======================================================
======================================================
======================================================
5. Открываем engine/modules/show.full.php
\\\\\\\\\\После
if ( $row['category'] )
$tpl->set( '{category-url}', $config['http_home_url'] . get_url( $row['category'] ) . "/" );
else
$tpl->set( '{category-url}', "#" );

\\\\\\\\\\Добавить
$genresList = explode('|',$row['genre']);
$genres = '';
$cntGenres = count($genresList);
$ai = 0;

foreach ($genresList as $genre)
{
$ai++;
$genre = trim($genre);
$genres .= '<a href="/genre/'.urlencode(str_replace(' ','_',$genre)).'" title="'.$genre.'">'.$genre.'</a>';
if ($ai<$cntGenres) $genres .= ', ';
}
unset($genresList);

if (!empty($row['genre'])) {
$genreall= $genres;
}
$tpl->set( '{genreall}', $genreall);

$datexsList = explode('|',$row['datex']);
$datexs = '';
$cntDatexs = count($datexsList);
$ai = 0;

foreach ($datexsList as $datex)
{
$ai++;
$datex = trim($datex);
$datexs .= '<a href="/datex/'.urlencode(str_replace(' ','_',$datex)).'" title="'.$datex.'">'.$datex.'</a>';
if ($ai<$cntDatexs) $datexs .= ', ';
}
unset($datexsList);

if (!empty($row['datex'])) {
$datexall= $datexs;
}
$tpl->set( '{datexall}', $datexall);

$directorsList = explode('|',$row['director']);
$directors = '';
$cntDirectors = count($directorsList);
$ai = 0;

foreach ($directorsList as $director)
{
$ai++;
$director = trim($director);
$directors .= '<a href="/director/'.urlencode(str_replace(' ','_',$director)).'" title="'.$director.'">'.$director.'</a>';
if ($ai<$cntDirectors) $directors .= ', ';
}
unset($directorsList);

if (!empty($row['director'])) {
$directorall= $directors;
}
$tpl->set( '{directorall}', $directorall);
$producersList = explode('|',$row['producer']);
$producers = '';
$cntProducers = count($producersList);
$ai = 0;

foreach ($producersList as $producer)
{
$ai++;
$producer = trim($producer);
$producers .= '<a href="/producer/'.urlencode(str_replace(' ','_',$producer)).'" title="'.$producer.'">'.$producer.'</a>';
if ($ai<$cntProducers) $producers .= ', ';
}
unset($producersList);

if (!empty($row['producer'])) {
$producerall= $producers;
}
$tpl->set( '{producerall}', $producerall);

$actorsList = explode('|',$row['actors']);
$actors = '';
$cntActors = count($actorsList);
$ai = 0;

foreach ($actorsList as $actor)
{
$ai++;
$actor = trim($actor);
$actors .= '<a href="/cast/'.urlencode(str_replace(' ','_',$actor)).'" title="'.$actor.'">'.$actor.'</a>';
if ($ai<$cntActors) $actors .= ', ';
}
unset($actorsList);

if (!empty($row['actors'])) {
$actorall= $actors;
}
$tpl->set( '{actorall}', $actorall);

$year1 = $row['year'];
$tpl->set( '{year}', $year1!='' ? '<a href="/year/'.str_replace(' ','_',$year1).'" title="'.$year1.'">'.$year1.'</a>' : '');
$country = $row['country'];
$tpl->set( '{country}', $year1!='' ? '<a href="/country/'.urlencode(str_replace(' ','_',$country)).'" title="'.$country.'">'.$country.'</a>' : '');
======================================================
\\\\\\\\\\Заменить
$db->query( "SELECT id, date, short_story, xfields, title, category, alt_name FROM " . PREFIX . "_post WHERE {$allowed_cats}MATCH (title, short_story, full_story, xfields) AGAINST ('$body') AND id != " . $row['id'] . " AND approve=1" . $where_date . " LIMIT " . $config['related_number'] );

\\\\\\\\\\На
$db->query( "SELECT id, date, short_story, xfields, title, category, alt_name, year, country, genre, datex, director, producer, actors FROM " . PREFIX . "_post WHERE {$allowed_cats}MATCH (title, short_story, full_story, xfields) AGAINST ('$body') AND id != " . $row['id'] . " AND approve=1" . $where_date . " LIMIT " . $config['related_number'] );
======================================================
======================================================
======================================================
======================================================
6. Открываем engine/engine.php
\\\\\\\\\\Находим, их там 3-и замены
id, autor, date,
\\\\\\\\\\Заменяем все на:
id, autor, year, country, genre, datex, director, producer, actors, date,
======================================================
\\\\\\\\\\Находим, их там 12-ть замен
p.id, p.autor, p.date,
\\\\\\\\\\Заменяем все на:
p.id, p.autor, p.year, p.country, p.genre, p.datex, p.director, p.producer, p.actors, p.date,
======================================================
\\\\\\\\\\После
case "alltags" :
include_once ENGINE_DIR . '/modules/tagscloud.php';
break;
\\\\\\\\\\Добавить

case "genres" :
include_once ENGINE_DIR . '/modules/genres.php';
break;
case "datexs" :
include_once ENGINE_DIR . '/modules/datexs.php';
break;

case "directors" :
include_once ENGINE_DIR . '/modules/directors.php';
break;
case "producers" :
include_once ENGINE_DIR . '/modules/producers.php';
break;

case "actors" :
include_once ENGINE_DIR . '/modules/actors.php';
break;

case "year" :
include_once ENGINE_DIR . '/modules/year.php';
break;

case "country" :
include_once ENGINE_DIR . '/modules/country.php';
break;
======================================================
======================================================
======================================================
======================================================
======================================================
7. Открываем engine/modules/search.php
\\\\\\\\\\Находим
$titleonly_where = array ('0' => "MATCH(title,short_story,full_story,xfields) AGAINST ('{story}')", // Искать только в статьях

\\\\\\\\\\Заменяем все на:
$titleonly_where = array ('0' => "MATCH(title,short_story,full_story,year,country,genre,datex,director,producer,actors,xfields) AGAINST ('{story}')", // Искать только в статьях
======================================================
\\\\\\\\\\Находим
$titleonly_where = array ('0' => "short_story LIKE '%{story}%' OR full_story LIKE '%{story}%' OR xfields LIKE '%{story}%' OR title LIKE '%{story}%'", // Искать только в статьях
\\\\\\\\\\Заменяем все на:
$titleonly_where = array ('0' => "short_story LIKE '%{story}%' OR full_story LIKE '%{story}%' OR year LIKE '%{story}%' OR country LIKE '%{story}%' OR genre LIKE '%{story}%' OR datex LIKE '%{story}%' OR director LIKE '%{story}%' OR producer LIKE '%{story}%' OR actors LIKE '%{story}%' OR xfields LIKE '%{story}%' OR title LIKE '%{story}%'", // Искать только в статьях
======================================================
\\\\\\\\\\Находим
$posts_fields = "SELECT SQL_CALC_FOUND_ROWS id, autor, " . PREFIX . "_post.date AS newsdate, " . PREFIX . "_post.date AS date, short_story AS story, " . PREFIX . "_post.xfields AS xfields, title, descr, keywords, category, alt_name, comm_num AS comm_in_news, allow_comm, rating, news_read, editdate, editor, reason, view_edit, tags, '' AS output_comms";
\\\\\\\\\\Заменяем все на:
$posts_fields = "SELECT SQL_CALC_FOUND_ROWS id, autor, " . PREFIX . "_post.date AS newsdate, " . PREFIX . "_post.date AS date, short_story AS story, " . PREFIX . "_post.xfields AS xfields, title, descr, keywords, category, alt_name, comm_num AS comm_in_news, allow_comm, rating, news_read, editdate, editor, reason, view_edit, tags, year, country, genre, datex, director, producer, actors, '' AS output_comms";
======================================================
\\\\\\\\\\После
if( $config['allow_alt_url'] == "yes" ) $tpl->set( '{result-author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/\">" . $row['autor'] . "</a>" );
else $tpl->set( '{result-author}', "<a {$go_page} href=\"$PHP_SELF?subaction=userinfo&amp;user=" . urlencode( $row['autor'] ) . "\">" . $row['autor'] . "</a>" );
\\\\\\\\\\Добавить
$genresList = explode('|',$row['genre']);
$genres = '';
$cntGenres = count($genresList);
$ai = 0;

foreach ($genresList as $genre)
{
$ai++;
$genre = trim($genre);
$genres .= '<a href="/genre/'.urlencode(str_replace(' ','_',$genre)).'" title="'.$genre.'">'.$genre.'</a>';
if ($ai<$cntGenres) $genres .= ', ';
}
unset($genresList);

if (!empty($row['genre'])) {
$genreall= $genres;
}
$tpl->set( '{genreall}', $genreall);

$datexsList = explode('|',$row['datex']);
$datexs = '';
$cntDatexs = count($datexsList);
$ai = 0;

foreach ($datexsList as $datex)
{
$ai++;
$datex = trim($datex);
$datexs .= '<a href="/datex/'.urlencode(str_replace(' ','_',$datex)).'" title="'.$datex.'">'.$datex.'</a>';
if ($ai<$cntDatexs) $datexs .= ', ';
}
unset($datexsList);

if (!empty($row['datex'])) {
$datexall= $datexs;
}
$tpl->set( '{datexall}', $datexall);

$directorsList = explode('|',$row['director']);
$directors = '';
$cntDirectors = count($directorsList);
$ai = 0;

foreach ($directorsList as $director)
{
$ai++;
$director = trim($director);
$directors .= '<a href="/director/'.urlencode(str_replace(' ','_',$director)).'" title="'.$director.'">'.$director.'</a>';
if ($ai<$cntDirectors) $directors .= ', ';
}
unset($directorsList);

if (!empty($row['director'])) {
$directorall= $directors;
}
$tpl->set( '{directorall}', $directorall);

$producersList = explode('|',$row['producer']);
$producers = '';
$cntProducers = count($producersList);
$ai = 0;

foreach ($producersList as $producer)
{
$ai++;
$producer = trim($producer);
$producers .= '<a href="/producer/'.urlencode(str_replace(' ','_',$producer)).'" title="'.$producer.'">'.$producer.'</a>';
if ($ai<$cntProducers) $producers .= ', ';
}
unset($producersList);

if (!empty($row['producer'])) {
$producerall= $producers;
}
$tpl->set( '{producerall}', $producerall);

$actorsList = explode('|',$row['actors']);
$actors = '';
$cntActors = count($actorsList);
$ai = 0;

foreach ($actorsList as $actor)
{
$ai++;
$actor = trim($actor);
$actors .= '<a href="/cast/'.urlencode(str_replace(' ','_',$actor)).'" title="'.$actor.'">'.$actor.'</a>';
if ($ai<$cntActors) $actors .= ', ';
}
unset($actorsList);

if (!empty($row['actors'])) {
$actorall= $actors;
}
$tpl->set( '{actorall}', $actorall);

$year1 = $row['year'];
$tpl->set( '{year}', $year1!='' ? '<a href="/year/'.str_replace(' ','_',$year1).'" title="'.$year1.'">'.$year1.'</a>' : '');
$country = $row['country'];
$tpl->set( '{country}', $year1!='' ? '<a href="/country/'.urlencode(str_replace(' ','_',$country)).'" title="'.$country.'">'.$country.'</a>' : '');
======================================================
======================================================
======================================================
======================================================
======================================================
8. Открываем engine/modules/addnews.php
\\\\\\\\\\После
else $_POST['tags'] = @$db->safesql( htmlspecialchars( strip_tags( stripslashes( trim( $_POST['tags'] ) ) ), ENT_QUOTES ) );
\\\\\\\\\\Добавить
$country = str_replace("|", ", ", $row['country']);
$genre = str_replace("|", ", ", $row['genre']);
$datex = str_replace("|", ", ", $row['datex']);
$director = str_replace("|", ", ", $row['director']);
$producer = str_replace("|", ", ", $row['producer']);
$actors = str_replace("|", ", ", $row['actors']);
======================================================
\\\\\\\\\\После
if( $alt_name == "" or ! $alt_name ) $alt_name = totranslit( stripslashes( $title ), true, false );
else $alt_name = totranslit( $alt_name, true, false );
\\\\\\\\\\Добавить
$year = $_POST['year'];
$country = $_POST['country'];
$genre = $_POST['genre'];
$genrelist = explode(",", $genre);
$genre = '';
$ngenre = count($genrelist);
foreach($genrelist as $key=>$value)
{
$genre .= trim($value);
if ($key < $ngenre-1)
$genre .= "|";
}
$datex = $_POST['datex'];
$datexlist = explode(",", $datex);
$datex = '';
$ndatex = count($datexlist);
foreach($datexlist as $key=>$value)
{
$datex .= trim($value);
if ($key < $ndatex-1)
$datex .= "|";
}
$director = $_POST['director'];
$directorlist = explode(",", $director);
$director = '';
$ndirector = count($directorlist);
foreach($directorlist as $key=>$value)
{
$director .= trim($value);
if ($key < $ndirector-1)
$director .= "|";
}
$producer = $_POST['producer'];
$producerlist = explode(",", $producer);
$producer = '';
$nproducer = count($producerlist);
foreach($producerlist as $key=>$value)
{
$producer .= trim($value);
if ($key < $nproducer-1)
$producer .= "|";
}
$actors = $_POST['actors'];
$actorslist = explode(",", $actors);
$actors = '';
$nactors = count($actorslist);
foreach($actorslist as $key=>$value)
{
$actors .= trim($value);
if ($key < $nactors-1)
$actors .= "|";
}
======================================================
======================================================
======================================================
======================================================
======================================================
9. Открываем engine/modules/show.custom.php
\\\\\\\\\\После
$tpl->set( '{category-icon}', $cat_info[$row['category']]['icon'] );

} else {

$tpl->set( '{category-icon}', "{THEME}/dleimages/no_icon.gif" );

}

\\\\\\\\\\Добавить
$genresList = explode('|',$row['genre']);
$genres = '';
$cntGenres = count($genresList);
$ai = 0;

foreach ($genresList as $genre)
{
$ai++;
$genre = trim($genre);
$genres .= '<a href="/genre/'.urlencode(str_replace(' ','_',$genre)).'" title="'.$genre.'">'.$genre.'</a>';
if ($ai<$cntGenres) $genres .= ', ';
}
unset($genresList);

if (!empty($row['genre'])) {
$genreall= $genres;
}
$tpl->set( '{genreall}', $genreall);
$datexsList = explode('|',$row['datex']);
$datexs = '';
$cntDatexs = count($datexsList);
$ai = 0;

foreach ($datexsList as $datex)
{
$ai++;
$datex = trim($datex);
$datexs .= '<a href="/datex/'.urlencode(str_replace(' ','_',$datex)).'" title="'.$datex.'">'.$datex.'</a>';
if ($ai<$cntDatexs) $datexs .= ', ';
}
unset($datexsList);

if (!empty($row['datex'])) {
$datexall= $datexs;
}
$tpl->set( '{datexall}', $datexall);

$directorsList = explode('|',$row['director']);
$directors = '';
$cntDirectors = count($directorsList);
$ai = 0;

foreach ($directorsList as $director)
{
$ai++;
$director = trim($director);
$directors .= '<a href="/director/'.urlencode(str_replace(' ','_',$director)).'" title="'.$director.'">'.$director.'</a>';
if ($ai<$cntDirectors) $directors .= ', ';
}
unset($directorsList);

if (!empty($row['director'])) {
$directorall= $directors;
}
$tpl->set( '{directorall}', $directorall);
$producersList = explode('|',$row['producer']);
$producers = '';
$cntProducers = count($producersList);
$ai = 0;

foreach ($producersList as $producer)
{
$ai++;
$producer = trim($producer);
$producers .= '<a href="/producer/'.urlencode(str_replace(' ','_',$producer)).'" title="'.$producer.'">'.$producer.'</a>';
if ($ai<$cntProducers) $producers .= ', ';
}
unset($producersList);

if (!empty($row['producer'])) {
$producerall= $producers;
}
$tpl->set( '{producerall}', $producerall);

$actorsList = explode('|',$row['actors']);
$actors = '';
$cntActors = count($actorsList);
$ai = 0;

foreach ($actorsList as $actor)
{
$ai++;
$actor = trim($actor);
$actors .= '<a href="/cast/'.urlencode(str_replace(' ','_',$actor)).'" title="'.$actor.'">'.$actor.'</a>';
if ($ai<$cntActors) $actors .= ', ';
}
unset($actorsList);

if (!empty($row['actors'])) {
$actorall= $actors;
}
$tpl->set( '{actorall}', $actorall);

$year1 = $row['year'];
$tpl->set( '{year}', $year1!='' ? '<a href="/year/'.str_replace(' ','_',$year1).'" title="'.$year1.'">'.$year1.'</a>' : '');
$country = $row['country'];
$tpl->set( '{country}', $year1!='' ? '<a href="/country/'.urlencode(str_replace(' ','_',$country)).'" title="'.$country.'">'.$country.'</a>' : '');
======================================================
======================================================
======================================================
======================================================
======================================================
10. Открываем engine/modules/show.custom.php
\\\\\\\\\\Находим
$db->query( "SELECT p.id, p.date, p.short_story, p.xfields, p.title, p.category, p.alt_name FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE p.approve=1 AND p.date >= '$this_month' - INTERVAL 1 MONTH AND p.date < '$this_month' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,10" );

\\\\\\\\\\Заменяем все на:
$db->query( "SELECT p.id, p.date, p.year, p.country, p.genre, p.datex, p.director, p.producer, p.actors, p.short_story, p.xfields, p.title, p.category, p.alt_name FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE p.approve=1 AND p.date >= '$this_month' - INTERVAL 1 MONTH AND p.date < '$this_month' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,10" );
======================================================
======================================================
======================================================
======================================================
======================================================
11. Открываем engine/ajax/search.php
\\\\\\\\\\Находим
$db->query("SELECT id, short_story, title, date, alt_name, category FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1".$this_date." AND (short_story LIKE '%{$query}%' OR full_story LIKE '%{$query}%' OR xfields LIKE '%{$query}%' OR title LIKE '%{$query}%') ORDER by date DESC LIMIT 5");
\\\\\\\\\\Заменяем все на:
$db->query("SELECT id, short_story, title, date, alt_name, category, year, country, genre, datex, director, producer, actors FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1".$this_date." AND (short_story LIKE '%{$query}%' OR full_story LIKE '%{$query}%' OR xfields LIKE '%{$query}%' OR title LIKE '%{$query}%' OR year LIKE '%{$query}%' OR country LIKE '%{$query}%' OR genre LIKE '%{$query}%' OR datex LIKE '%{$query}%' OR director LIKE '%{$query}%' OR producer LIKE '%{$query}%' OR actors LIKE '%{$query}%') ORDER by date DESC LIMIT 5");
======================================================
======================================================
======================================================
======================================================
======================================================
12. Открываем engine/modules/favorites.php
\\\\\\\\\\Находим
$sql_select = "SELECT p.id, p.autor, p.date, p.short_story, SUBSTRING(p.full_story, 1, 15) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE {$stop_list}id in $favorites ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
\\\\\\\\\\Заменяем все на:
$sql_select = "SELECT p.id, p.autor, p.year, p.country, p.genre, p.datex, p.director, p.producer, p.actors, p.date, p.short_story, SUBSTRING(p.full_story, 1, 15) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE {$stop_list}id in $favorites ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
======================================================
======================================================
======================================================
======================================================
======================================================
\\\\\\\\\\В шаблон shortstory.tpl и fullstory.tpl и [color=#000000][font=verdana][size=2]searchresult.tpl[/size][/font][/color] в нужное место вставить:
{year}
{country}
{genreall}
{datexall}
{directorall}
{producerall}
{actorall}
[/html]

если вас заинтересовало то пишите в ЛС поделюсь

Изменено пользователем D0Gmatist
Ссылка на сообщение
Поделиться на других сайтах

у меня одна просьба ... если тут есть те кто разбирается в этом данный хак-модуль

работает отлично ... но !!!

если выводить любой .tpl через к примеру {custom category="14,1000" template="shortstory" aviable="global" from="0" limit="8" cache="yes"}

то теги , такие как

{year}

{country}

{genreall}

{datexall}

{directorall}

{producerall}

{actorall}

срабатывают, но но ни чего не выводят

Ссылка на сообщение
Поделиться на других сайтах

Давно такой говноделой инструкции не видел. Надоели недоучки.

Ну нот чем не устраивают доп поля? хаков по перекрёстным ссылкам много.

Изменено пользователем a1ex
Ссылка на сообщение
Поделиться на других сайтах

да ... вау доп.поля... офигенно они в поиске работают

Давно такой говноделой инструкции не видел. Надоели недоучки.

Ну нот чем не устраивают доп поля? хаков по перекрёстным ссылкам много.

напиши лучше, умник
Ссылка на сообщение
Поделиться на других сайтах

нормально они там работают. если голову включить.

Да и твое говнотворение не использует индексы, молчал бы по поводу оптимизации.

Кто меня знает, тот в курсе, что мною написаны аналогичные хаки при инсталляции кода в нескольких местах по 2строчки, а такому мусорщику доказывать вряд ли кто-то будет, тем более на нулле

Изменено пользователем a1ex
Ссылка на сообщение
Поделиться на других сайтах

http://4dle.ru/sel_m...olnitelnym.html

http://4dle.ru/sel_m...ide-ssylok.html

Много раз уже говорил - когда публикуете свои скрипты имейте ответственность за них, ведь ими будут пользоваться.

Зы Да и о твоей компетенции говорят твои комментарии D

ЗЫ2 В предлагаемом коде потенциальная SQL инъекция

Изменено пользователем a1ex
Ссылка на сообщение
Поделиться на других сайтах

это полу хак полу модуль под DLE

если кому нужен хак-модуль то пишите в Skype /nbr.mr.8pa4/

Изменено пользователем D0Gmatist
Ссылка на сообщение
Поделиться на других сайтах

Присоединяйтесь к обсуждению

Вы можете опубликовать сообщение сейчас, а зарегистрироваться позже. Если у вас есть аккаунт, войдите в него для написания от своего имени.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

×
×
  • Создать...