Skip to content

Commit

Permalink
v.4.2.5
Browse files Browse the repository at this point in the history
- author=this и notAuthor=this теперь работает.
- tag=this и notTag=this теперь тоже работает.
- добавил обработку экранированных символов в тексте.
- исправил ошибку с несохранением выбранного в списке шаблона при
генерации блока
  • Loading branch information
pafnuty committed Sep 25, 2014
1 parent 6c87ccd commit a2621dc
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
4 changes: 2 additions & 2 deletions upload/blockpro_install.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
'moduleDescr' => 'Модуль вывода новостей для DLE',

// Версия модуля, для установщика
'moduleVersion' => '4.2.4',
'moduleVersion' => '4.2.5',

// Дата выпуска модуля, для установщика
'moduleDate' => '21.09.2014',
'moduleDate' => '26.09.2014',

// Версии DLE, поддержваемые модулем, для установщика
'dleVersion' => '10.x',
Expand Down
2 changes: 1 addition & 1 deletion upload/engine/inc/blockpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
define('MODULE_DIR', ENGINE_DIR . '/modules/base/admin/blockpro/');

$moduleName = 'blockpro';
$moduleVersion = '4.2.4';
$moduleVersion = '4.2.5';

$moderate = $_REQUEST['moderate'];
$moderate_checked = ($moderate) ? 'checked' : '' ;
Expand Down
5 changes: 3 additions & 2 deletions upload/engine/modules/base/admin/blockpro/generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
}

function getTemplatesList($dir) {
global $cfg;
global $cfg, $template;

$tplFiles = array();
$tplFiles[] = '<option value="">Выберите шаблон</option>';
$f = scandir($dir);
foreach ($f as $file){
$filename = str_replace('.tpl', '', $file);
// $act = ('blockpro/' . $filename == $cfg['template']) ? 'selected' : '' ;
$act = (('blockpro/' . $filename) == $template) ? 'selected' : '' ;

if(preg_match('/\.(tpl)/', $file)){
$tplFiles[] = '<option '.$act.' value="blockpro/'.$filename.'">'. $filename.'</option>';
}
Expand Down
21 changes: 18 additions & 3 deletions upload/engine/modules/base/blockpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,22 @@ classic: << Первая < 1 [2] 3 > Последняя >>
$wheres[] = $ignorePosts . 'id regexp "[[:<:]](' . str_replace(',', '|', $postsArr) . ')[[:>:]]"';
}

$_currentAuthor = false;
// Фильтрация новостей по АВТОРАМ
if ($base->cfg['author'] == 'this') {
$base->cfg['author'] = $base->db->parse('?s', $_REQUEST["user"]);
$_currentAuthor = true;
}
if ($base->cfg['notAuthor'] == 'this') {
$base->cfg['notAuthor'] = $base->db->parse('?s', $_REQUEST["user"]);
$_currentAuthor = true;
}
if ($base->cfg['author'] || $base->cfg['notAuthor']) {
$ignoreAuthors = ($base->cfg['notAuthor']) ? 'NOT ' : '';
$authorsArr = ($base->cfg['notAuthor']) ? $base->cfg['notAuthor'] : $base->cfg['author'];
$wheres[] = $ignoreAuthors . 'autor regexp "[[:<:]](' . str_replace(',', '|', $authorsArr) . ')[[:>:]]"';
$wheres[] = ($_currentAuthor)
? $ignoreAuthors . 'autor = '. $authorsArr
: $ignoreAuthors . 'autor regexp "[[:<:]](' . str_replace(',', '|', $authorsArr) . ')[[:>:]]"';
}

// Фильтрация новостей по ДОПОЛНИТЕЛЬНЫМ ПОЛЯМ (проверяется только на заполненность)
Expand Down Expand Up @@ -333,18 +338,24 @@ classic: << Первая < 1 [2] 3 > Последняя >>
$wheres[] = implode($_xfSearchLogic, $xfWheres);
}

$_currentTag = false;
// Фильтрация новостей по ТЕГАМ
if ($base->cfg['tags'] == 'this') {
$base->cfg['tags'] = $base->db->parse('?s', $_REQUEST["tag"]);
$_currentTag = true;
}
if ($base->cfg['notTags'] == 'this') {
$base->cfg['notTags'] = $base->db->parse('?s', $_REQUEST["tag"]);
$_currentTag = true;
}

if ($base->cfg['tags'] || $base->cfg['notTags']) {
$ignoreTags = ($base->cfg['notTags']) ? 'NOT ' : '';
$tagsArr = ($base->cfg['notTags']) ? $base->cfg['notTags'] : $base->cfg['tags'];
$wheres[] = $ignoreTags . 'tags regexp "[[:<:]](' . str_replace(',', '|', $tagsArr) . ')[[:>:]]"';
$wheres[] = ($_currentTag)
? $ignoreTags . 'autor = '. $tagsArr
: $ignoreTags . 'autor regexp "[[:<:]](' . str_replace(',', '|', $tagsArr) . ')[[:>:]]"';

}

// Если включен режим вывода похожих новостей:
Expand Down Expand Up @@ -409,13 +420,17 @@ classic: << Первая < 1 [2] 3 > Последняя >>
// Получаем новости
$list = $base->db->getAll($query, $selectRows, PREFIX . '_post', PREFIX . '_post_extras', $ext_query . $where, $_startFrom, $base->cfg['limit']);

// Обрабатываем данные функцией stripslashes рекурсивно.
$list = stripSlashesInArray(&$list);

// Путь к папке с текущим шаблоном
$tplArr['theme'] = '/templates/' . $base->dle_config['skin'];

// Обрабатываем данные в массиве.
foreach ($list as $key => $value) {
$list[$key]['xfields'] = xfieldsdataload($value['xfields']);
// Плучаем обработанные допполя.
$list[$key]['xfields'] = stripSlashesInArray(xfieldsdataload($value['xfields']));

// Массив данных для формирования ЧПУ
$urlArr = array(
'category' => $value['category'],
Expand Down
11 changes: 9 additions & 2 deletions upload/engine/modules/base/core/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ public function addModifiers() {
);
}



/**
* @param $data - массив с информацией о статье
*
Expand Down Expand Up @@ -405,5 +403,14 @@ function baseShowRating($id, $rating, $vote_num, $allow = true) {
return $rated;
}

function stripSlashesInArray($data) {
if(is_array($data)) {
$data = array_map('stripSlashesInArray', &$data);
} else {
$data = stripslashes($data);
}

return $data;
}

?>

0 comments on commit a2621dc

Please sign in to comment.