diff --git a/README.md b/README.md index b1fc330..3866dbc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ### faq -### Вопрос | ответ v1.26.1 +### Вопрос | ответ v3.31 ### Модуль создания раширенной справочной системы на основе тегов. @@ -8,6 +8,8 @@ ### Changelog: +17.03.2026 - версия 3.31 + 04.09.2019 - версия 1.26.1 26.11.2015 - версия 1.0.1 \ No newline at end of file diff --git a/class/faq.php b/class/faq.php index 3510c5a..4993ae3 100644 --- a/class/faq.php +++ b/class/faq.php @@ -58,7 +58,7 @@ class Faq $AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq WHERE id = '" . $_GET['fid'] . "'"); $AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "'"); - $AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_GET['fid']); + self::_clearFaqCache(); } header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION); @@ -80,7 +80,7 @@ class Faq { $AVE_DB->Query("UPDATE " . PREFIX . "_module_faq SET faq_title = '" . mb_substr($faq_title, 0, 100) . "', faq_description = '" . mb_substr($_POST['faq_description'][$id], 0, 255) . "' WHERE id = '" . $id . "'"); - $AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $id); + self::_clearFaqCache(); } } @@ -204,7 +204,7 @@ class Faq } } - $AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_POST['fid']); + self::_clearFaqCache(); header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid=" . $_POST['fid'] . "&cp=" . SESSION); exit; @@ -229,7 +229,7 @@ class Faq $AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "' AND id = '" . $_GET['id'] . "'"); - $AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_GET['fid']); + self::_clearFaqCache(); header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid=" . $_GET['fid'] . "&cp=" . SESSION); exit; @@ -253,6 +253,32 @@ class Faq $AVE_Template->assign($faq); $AVE_Template->assign('questions', $questions); } + + /** + * Очистка кэша модуля FAQ + */ + private static function _clearFaqCache() + { + global $AVE_Template; + + $cache_dir = $AVE_Template->getCacheDir(); + + if (is_dir($cache_dir)) { + $files = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($cache_dir, RecursiveDirectoryIterator::SKIP_DOTS), + RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach ($files as $fileinfo) { + + if ($fileinfo->isFile() && strpos($fileinfo->getFilename(), 'show_faq') !== false) { + @unlink($fileinfo->getRealPath()); + } + } + } + + $AVE_Template->clearCompiledTemplate('show_faq.tpl'); + } } ?> diff --git a/info.php b/info.php index 4995393..154047a 100644 --- a/info.php +++ b/info.php @@ -4,7 +4,7 @@ $module = array( 'ModuleSysName' => 'faq', - 'ModuleVersion' => '1.26.1', + 'ModuleVersion' => '3.31', 'ModuleAutor' => 'Freeon', 'ModuleCopyright' => '© 2007-' . date('Y') . ' AVE.cms', 'ModuleStatus' => 1, diff --git a/module.php b/module.php index 89a4133..53d5cf4 100644 --- a/module.php +++ b/module.php @@ -25,11 +25,11 @@ function mod_faq($id) $tpl_dir = BASE_DIR . '/modules/faq/templates/'; // Путь к шаблону модуля - // Если нету в кеше, то начинаем обрабатывать + // Если нет в кеше, то начинаем обрабатывать if (!$AVE_Template->is_cached($tpl_dir . 'show_faq.tpl', $id)) { // Проверяем, есть ли папка для кеша, если нет (первый раз) — создаем - if (!is_dir($AVE_Template->cache_dir)) + if (!is_dir($AVE_Template->getCacheDir())) { $oldumask = umask(0); @mkdir($AVE_Template->cache_dir, 0777); diff --git a/templates/admin_faq_edit.tpl b/templates/admin_faq_edit.tpl index 57dccc5..3c942a3 100644 --- a/templates/admin_faq_edit.tpl +++ b/templates/admin_faq_edit.tpl @@ -20,7 +20,7 @@
\ No newline at end of file diff --git a/templates/show_faq.tpl b/templates/show_faq.tpl index 55cf54c..e1328f8 100644 --- a/templates/show_faq.tpl +++ b/templates/show_faq.tpl @@ -1,24 +1,22 @@