Skip to content

Commit

Permalink
Merge pull request #177 from dle-modules/feature/6.0.3
Browse files Browse the repository at this point in the history
6.0.3
  • Loading branch information
pafnuty authored May 11, 2020
2 parents fa38c9d + f07f2d8 commit ea477c3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 17 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 6.0.3
- Исправлено некорректное формирование переменной с текущем шаблоном сайта (#176)

# 6.0.2
- Небольшой фикс ормирования URL с учётом модуля MultiLAnguage
- Небольшой фикс формирования URL с учётом модуля MultiLAnguage

# 6.0.1
- Полностью прекращена поддержка DLE старше 13 версии.
Expand Down
2 changes: 1 addition & 1 deletion blockpro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>BlockPro</name>
<description>Модуль предназначен для удобного вывода новостей на сайте</description>
<icon>engine/skins/images/blockpro.png</icon>
<version>6.0.2</version>
<version>6.0.3</version>
<dleversion>13</dleversion>
<versioncompare>greater</versioncompare>
<upgradeurl>https://updates.pafnuty.name/check-bp.php</upgradeurl>
Expand Down
2 changes: 1 addition & 1 deletion engine/inc/blockpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
define('MODULE_DIR', ENGINE_DIR . '/modules/base/admin/blockpro/');

$moduleName = 'blockpro';
$moduleVersion = '6.0.2';
$moduleVersion = '6.0.3';

$moderate = $_REQUEST['moderate'];
$moderate_checked = ($moderate) ? 'checked' : '';
Expand Down
31 changes: 19 additions & 12 deletions engine/modules/base/blockpro.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,27 @@
$cfg['cachePrefix'] = 'base';
}

// Определяемся с шаблоном сайта
// Проверим куку пользователя и наличие параметра skin в реквесте.
$currentSiteSkin = (isset($_COOKIE['dle_skin'])) ? trim(totranslit($_COOKIE['dle_skin'], false, false))
: ((isset($_REQUEST['skin'])) ? trim(totranslit($_REQUEST['skin'], false, false)) : $config['skin']);

// Если итоге пусто — назначим опять шаблон из конфига.
if ($currentSiteSkin == '') {
$currentSiteSkin = $config['skin'];
// Определяемся с правильным шаблоном сайта
$currentSiteSkin = $config['skin'];


if ($_REQUEST['skin']) {
$_REQUEST['skin'] = $_REQUEST['dle_skin'] = trim(totranslit($_REQUEST['skin'], false, false));
}
// Если парки с шаблоном нет — дальше не работаем.
if (!@is_dir(ROOT_DIR.'/templates/'.$currentSiteSkin)) {
die('no_skin');

if ($_REQUEST['dle_skin']) {
$_REQUEST['dle_skin'] = trim(totranslit($_REQUEST['dle_skin'], false, false));
if ($_REQUEST['dle_skin'] AND @is_dir(ROOT_DIR.'/templates/'.$_REQUEST['dle_skin'])) {
$currentSiteSkin = $_REQUEST['dle_skin'];
}
} elseif ($_COOKIE['dle_skin']) {
$_COOKIE['dle_skin'] = trim(totranslit((string)$_COOKIE['dle_skin'], false, false));
if ($_COOKIE['dle_skin'] AND is_dir(ROOT_DIR.'/templates/'.$_COOKIE['dle_skin'])) {
$currentSiteSkin = $_COOKIE['dle_skin'];
}
}


// Формируем имя кеша
$cacheName = implode('_', $cfg).$currentSiteSkin;

Expand Down Expand Up @@ -1127,7 +1134,7 @@

// Результат обработки шаблона
try {
$output = $base->tpl->fetch($base->cfg['template'].'.tpl', $tplArr);
$output = $base->tpl->fetch($base->dle_config['skin'].'/' . $base->cfg['template'].'.tpl', $tplArr);
} catch (Exception $e) {
$outputLog['errors'][] = $e->getMessage();
$base->cfg['nocache'] = true;
Expand Down
3 changes: 1 addition & 2 deletions engine/modules/base/core/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public static function getDb() {
}

public function getTemplater($tplOptions) {
$this->tpl = Fenom::factory(ROOT_DIR.'/templates/'.$this->dle_config['skin'].'/', ENGINE_DIR.'/cache/',
$tplOptions);
$this->tpl = Fenom::factory(ROOT_DIR.'/templates/', ENGINE_DIR.'/cache/', $tplOptions);
// Добавляем модификаторы
$this->addModifiers();
}
Expand Down

0 comments on commit ea477c3

Please sign in to comment.