+++ fix for Smarty 5

This commit is contained in:
2025-11-09 14:45:12 +05:00
parent 3e40ae1b43
commit b7b0573e61
2 changed files with 53 additions and 51 deletions

View File

@@ -1660,18 +1660,18 @@ function _cleanvar($var)
if (!empty($request_author))
$history['dialog']['request'] = array_merge($history['dialog']['request'], $request_author);
// ответы
foreach ($history['dialog']['response'] as &$response)
{
$response_author = $AVE_DB->Query("
SELECT user_name, firstname, lastname
FROM " . PREFIX . "_users
WHERE Id = '" . $response['user_id'] . "'
")->FetchAssocArray();
// ответы
foreach ($history['dialog']['response'] ?? [] as &$response)
{
$response_author = $AVE_DB->Query("
SELECT user_name, firstname, lastname
FROM " . PREFIX . "_users
WHERE Id = '" . $response['user_id'] . "'
")->FetchAssocArray();
if (!empty($response_author))
$response = array_merge($response, $response_author);
}
if (!empty($response_author))
$response = array_merge($response, $response_author);
}
// форма ответа
if (empty($history['dialog']['response_draft']))

View File

@@ -37,8 +37,8 @@
$fid = parseInt('{$fid}');
$sess = '{$sess}';
$smarty = new Array;
$smarty['start_alert'] = '{$alert.text}';
$smarty['start_alert_theme'] = '{$alert.theme}';
$smarty['start_alert'] = '{$alert.text|default:''}';
$smarty['start_alert_theme'] = '{$alert.theme|default:''}';
</script>
<div class="title">
@@ -91,38 +91,38 @@ $smarty['start_alert_theme'] = '{$alert.theme}';
{/if}
</td>
</tr>
{if $dialog.response}
<tr>
<td colspan="2"><h5>{if $dialog.response|@count == 1}{#response#}{else}{#responses#}{/if}</h5></td>
</tr>
{foreach from=$dialog.response item=item}
<tr>
<td valign="middle">
{if $item.user_name}
[<a target="_blank" href="index.php?do=user&amp;action=edit&Id={$item.user_id}&cp={$sess}" class="toprightDir" title="{#profile_look#}">{$item.user_name}</a>] {if $item.firstname || $item.lastname}{$item.firstname} {$item.lastname}{/if}<br/>
{/if}
{#from#} <a href="mailto:{$item.from_email}" title="{#write_email#}" class="toprightDir">{$item.from_email}</a> &lt;{$item.from_name|escape}&gt;<br/>
<span class="date_text dgrey">{$item.date|date_format:$TIME_FORMAT|pretty_date}</span>
</td>
<td>
{if $item.format=='text'}
<div style="white-space:pre">{$item.body}</div>
{else}
{$item.body}
{/if}
</td>
</tr>
{/foreach}
{else}
<tr class="{if $status==='replied'}yellow{/if}">
<td colspan="2" style="padding:15px 10px;">
{if $status!=='replied'}<a href="index.php?do=modules&amp;action=modedit&amp;mod=forms&amp;moduleaction=dialog_status&amp;hid={$hid}&amp;status=replied&amp;fid={$fid}&amp;cp={$sess}" class="btn redBtn">{#set_replied#}</a>
{else}
<strong>{#marked_replied#}</strong>
{/if}
</td>
</tr>
{if !empty($dialog.response)}
<tr>
<td colspan="2"><h5>{if $dialog.response|@count == 1}{#response#}{else}{#responses#}{/if}</h5></td>
</tr>
{foreach from=$dialog.response item=item}
<tr>
<td valign="middle">
{if $item.user_name|default:false} <-- ИСПРАВЛЕНИЕ: Проверяем user_name безопасно
[<a target="_blank" href="index.php?do=user&amp;action=edit&Id={$item.user_id}&cp={$sess}" class="toprightDir" title="{#profile_look#}">{$item.user_name}</a>] {if $item.firstname|default:false || $item.lastname|default:false}{$item.firstname|default:''} {$item.lastname|default:''}{/if}<br/>
{/if}
{#from#} <a href="mailto:{$item.from_email}" title="{#write_email#}" class="toprightDir">{$item.from_email}</a> &lt;{$item.from_name|escape}&gt;<br/>
<span class="date_text dgrey">{$item.date|date_format:$TIME_FORMAT|pretty_date}</span>
</td>
<td>
{if $item.format=='text'}
<div style="white-space:pre">{$item.body}</div>
{else}
{$item.body}
{/if}
</td>
</tr>
{/foreach}
{else}
<tr class="{if $status==='replied'}yellow{/if}">
<td colspan="2" style="padding:15px 10px;">
{if $status!=='replied'}<a href="index.php?do=modules&amp;action=modedit&amp;mod=forms&amp;moduleaction=dialog_status&amp;hid={$hid}&amp;status=replied&amp;fid={$fid}&amp;cp={$sess}" class="btn redBtn">{#set_replied#}</a>
{else}
<strong>{#marked_replied#}</strong>
{/if}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
@@ -148,16 +148,18 @@ $smarty['start_alert_theme'] = '{$alert.theme}';
</tr>
<tr>
<td>{#mfld_subject#}:</td>
<td><input type="text" name="subject" placeholder="{#mfld_subject#}" class="mousetrap" value="{$dialog.response_draft.subject|escape|default:"RE: $subject"}"/></td>
<td><input type="text" name="subject" placeholder="{#mfld_subject#}" class="mousetrap" value="{($dialog.response_draft.subject|default:'')|escape|default:"RE: $subject"}"/></td>
</tr>
<tr>
<td>{#format#}:</td>
<td>
<input class="mousetrap" type="radio" name="format" value="text" {if $dialog.response_draft.format!='html'}checked="checked"{/if}/>
<label>{#text#}</label>
<input class="mousetrap" type="radio" name="format" value="html" {if $dialog.response_draft.format=='html'}checked="checked"{/if}/>
<label>HTML</label>
</td>
<td>
<input class="mousetrap" type="radio" name="format" value="text"
{if $dialog.response_draft.format|default:'text'!='html'}checked="checked"{/if}/>
<label>{#text#}</label>
<input class="mousetrap" type="radio" name="format" value="html"
{if $dialog.response_draft.format|default:''=='html'}checked="checked"{/if}/>
<label>HTML</label>
</td>
</tr>
<tr>
<td>{#body#}</td>