update ver 3.31

This commit is contained in:
2026-03-17 21:32:33 +05:00
parent 965440a0eb
commit b577ccf739
7 changed files with 61 additions and 35 deletions

View File

@@ -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

View File

@@ -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');
}
}
?>

View File

@@ -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,

View File

@@ -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);

View File

@@ -20,7 +20,7 @@
<div class="widget first">
<div class="head">
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<h5 class="iFrames">{if isset($smarty.request.id) && $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
</div>

View File

@@ -24,7 +24,7 @@
<div class="widget first">
<div class="head">
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<h5 class="iFrames">{if ($smarty.request.id|default:'') != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
</div>
@@ -38,9 +38,9 @@
<tr>
<td class="second">
<div>
{if $smarty.session.use_editor == 0}
{if ($smarty.session.use_editor|default:0) == 0}
{$faq_quest}
{elseif $smarty.session.use_editor == 1}
{elseif ($smarty.session.use_editor|default:0) == 1}
<textarea class="mousetrap editor" id="faq_quest" name="faq_quest">{$faq_quest|escape}</textarea>
{/if}
</div>
@@ -54,9 +54,9 @@
<tr>
<td class="second">
<div>
{if $smarty.session.use_editor == 0}
{if ($smarty.session.use_editor|default:0) == 0}
{$faq_answer}
{elseif $smarty.session.use_editor == 1}
{elseif ($smarty.session.use_editor|default:0) == 1}
<textarea class="mousetrap editor" id="faq_answer" name="faq_answer">{$sfaq_answer|escape}</textarea>
{/if}
</div>
@@ -72,4 +72,4 @@
</tr>
</table>
</form>
</div>
</div>

View File

@@ -1,24 +1,22 @@
<h3>{$faq_title}</h3>
{if $questions}
<dl>
{foreach from=$questions item=question}
<dt><p><a href="javascript:void(0);">{$question->faq_quest}</a></p></dt>
<dd>
<h2>{$question->faq_quest}</h2>
{$question->faq_answer}
</dd>
{/foreach}
</dl>
{literal}
<script>
$(document).ready(function() {
$("dd").hide();
$("dt").unbind('click');
$("dt").click(function() {
$(this).toggleClass("highligh").next("dd").slideToggle();
});
});
</script>
{/literal}
<div class="accordion my-3" id="faqAccordion">
{foreach from=$questions item=question name=faq}
<div class="accordion-item">
<h2 class="accordion-header" id="heading{$smarty.foreach.faq.iteration}">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{$smarty.foreach.faq.iteration}" aria-expanded="false" aria-controls="collapse{$smarty.foreach.faq.iteration}">
{$question->faq_quest}
</button>
</h2>
<div id="collapse{$smarty.foreach.faq.iteration}" class="accordion-collapse collapse" aria-labelledby="heading{$smarty.foreach.faq.iteration}" data-bs-parent="#faqAccordion">
<div class="accordion-body">
{$question->faq_answer}
</div>
</div>
</div>
{/foreach}
</div>
{else}
<div class="alert alert-light">{#FAQ_NO_QUESTIONS#}</div>
{/if}