diff --git a/fields/doc_from_rub_list/field.php b/fields/doc_from_rub_list/field.php
index c5f4a72..c8a4b0e 100644
--- a/fields/doc_from_rub_list/field.php
+++ b/fields/doc_from_rub_list/field.php
@@ -70,7 +70,7 @@
if ($tpl_empty)
{
- $field_value = $document['document_title'];
+ $field_value = isset($document['document_title']) ? $document['document_title'] : '';
$field_value = clean_php($field_value);
$field_value = stripcslashes($field_value);
$field_value = htmlspecialchars_decode($field_value);
diff --git a/fields/doc_from_rub_list/tpl/field-doc.tpl b/fields/doc_from_rub_list/tpl/field-doc.tpl
index e7fb4dc..52d5766 100644
--- a/fields/doc_from_rub_list/tpl/field-doc.tpl
+++ b/fields/doc_from_rub_list/tpl/field-doc.tpl
@@ -28,4 +28,4 @@ document_lang_group Языковая группа документа
{$document.document_title} Просмотров: {$document.document_count_view}
*}
-{$document.document_title|stripcslashes}
\ No newline at end of file
+{$document.document_title|default:''|stripcslashes}
\ No newline at end of file
diff --git a/fields/doc_from_rub_tree/field.php b/fields/doc_from_rub_tree/field.php
index 8239e53..fc50761 100644
--- a/fields/doc_from_rub_tree/field.php
+++ b/fields/doc_from_rub_tree/field.php
@@ -81,9 +81,9 @@ case 'edit':
case 'doc':
$document = get_document($field_value);
- if ($tpl_empty)
+ if ($tpl_empty)
{
- $field_value = $document['document_title'];
+ $field_value = isset($document['document_title']) ? $document['document_title'] : '';
$field_value = clean_php($field_value);
$field_value = stripcslashes($field_value);
$field_value = htmlspecialchars_decode($field_value);
diff --git a/fields/doc_from_rub_tree/tpl/field-doc.tpl b/fields/doc_from_rub_tree/tpl/field-doc.tpl
index e7fb4dc..ebfb98a 100644
--- a/fields/doc_from_rub_tree/tpl/field-doc.tpl
+++ b/fields/doc_from_rub_tree/tpl/field-doc.tpl
@@ -28,4 +28,7 @@ document_lang_group Языковая группа документа
{$document.document_title} Просмотров: {$document.document_count_view}
*}
-{$document.document_title|stripcslashes}
\ No newline at end of file
+
+{if isset($document.document_title)}
+ {$document.document_title|default:''|stripcslashes}
+{/if}
\ No newline at end of file
diff --git a/functions/func.common.php b/functions/func.common.php
index 96bda27..8b56fb6 100644
--- a/functions/func.common.php
+++ b/functions/func.common.php
@@ -83,11 +83,10 @@ function rrmdir($dir, &$result = 0)
{
if (is_dir($dir))
{
- // 1. ИСПОЛЬЗУЕМ @ ДЛЯ ПОДАВЛЕНИЯ ПРЕДУПРЕЖДЕНИЙ И
- // 2. СРАЗУ ПРОВЕРЯЕМ, ЯВЛЯЕТСЯ ЛИ РЕЗУЛЬТАТ МАССИВОМ
+
$objects = @scandir($dir);
- if (is_array($objects)) // <-- ДОБАВЛЕНА ПРОВЕРКА!
+ if (is_array($objects))
{
foreach ($objects as $object)
{
@@ -102,13 +101,10 @@ function rrmdir($dir, &$result = 0)
}
else
{
- // Если scandir вернул false, мы не смогли прочитать директорию,
- // поэтому считаем, что удаление невозможно.
$result++;
return false;
}
- // 3. БЕЗОПАСНО ВЫЗЫВАЕМ reset(), так как $objects гарантированно массив
reset($objects);
$result = $result + (rmdir($dir) ? 0 : 1);
@@ -118,7 +114,7 @@ function rrmdir($dir, &$result = 0)
}
- /**
+/**
* Очистка текста от програмного кода
*
* @param string $text исходный текст
@@ -126,7 +122,7 @@ function rrmdir($dir, &$result = 0)
*/
function clean_php($text)
{
- return str_replace(array('', '