Skip to content

Commit

Permalink
Merge pull request #112 from ticktackk/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ticktackk authored Jan 6, 2022
2 parents f3a8dc4 + 854e917 commit 155e043
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
==========================

## 1.3.8 (`1030870`)

- **Fix:** `XF\Api\Templater` error message when calling API endpoints
- **Fix:** Inability to save phrases via admin control panel

## 1.3.7 (`1030770`)

- **Change:** On XF 2.2.7+ when minifying JS files go with the stock minifier service (#109)
Expand Down
41 changes: 22 additions & 19 deletions Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,31 @@ public static function dispatcherPostRender

/** @var ExtendedTemplater $templater */
$templater = $renderer->getTemplater();
$permissionErrors = $templater->getPermissionErrors();

if (count($permissionErrors))
if (\is_callable([$templater, 'getPermissionErrors']))
{
$warningHtml = '<div class="blockMessage blockMessage--warning"><h2 style="margin: 0 0 .5em 0">Permission errors</h2><ul>';
foreach ($permissionErrors AS $permissionError)
{
$warningHtml .= sprintf('<li>%s (%s:%d)</li>',
htmlspecialchars($permissionError['error']),
htmlspecialchars(FileUtil::stripRootPathPrefix($permissionError['file'])),
$permissionError['line']
);
}
$warningHtml .= '</ul></div>';
$permissionErrors = $templater->getPermissionErrors();

if (strpos($content, '<!--XF:EXTRA_OUTPUT-->') !== false)
if (count($permissionErrors))
{
$content = str_replace('<!--XF:EXTRA_OUTPUT-->', $warningHtml . '<!--XF:EXTRA_OUTPUT-->', $content);
}
else
{
$content = preg_replace('#<body[^>]*>#i', "\\0$warningHtml", $content);
$warningHtml = '<div class="blockMessage blockMessage--warning"><h2 style="margin: 0 0 .5em 0">Permission errors</h2><ul>';
foreach ($permissionErrors AS $permissionError)
{
$warningHtml .= sprintf('<li>%s (%s:%d)</li>',
htmlspecialchars($permissionError['error']),
htmlspecialchars(FileUtil::stripRootPathPrefix($permissionError['file'])),
$permissionError['line']
);
}
$warningHtml .= '</ul></div>';

if (strpos($content, '<!--XF:EXTRA_OUTPUT-->') !== false)
{
$content = str_replace('<!--XF:EXTRA_OUTPUT-->', $warningHtml . '<!--XF:EXTRA_OUTPUT-->', $content);
}
else
{
$content = preg_replace('#<body[^>]*>#i', "\\0$warningHtml", $content);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions XF/Admin/Controller/Phrase.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public function actionSave(ParameterBag $params)
$db = $this->app()->db();
$db->beginTransaction();

$reply = parent::actionSave($parameterBag);
$reply = parent::actionSave($params);

/** @noinspection PhpUndefinedFieldInspection */
if (!$parameterBag->phrase_id && $reply instanceof RedirectReply)
if (!$params->phrase_id && $reply instanceof RedirectReply)
{
$phrases = $this->filter('phrases', 'array');
if (count($phrases))
Expand Down
4 changes: 2 additions & 2 deletions addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"legacy_addon_id": "",
"title": "Developer Tools",
"description": "This add-on provides enhancements for add-on developers.",
"version_id": 1030770,
"version_string": "1.3.7",
"version_id": 1030870,
"version_string": "1.3.8",
"dev": "TickTackk",
"dev_url": "https://xenforo.com/community/members/ticktackk.90375/",
"faq_url": "",
Expand Down

0 comments on commit 155e043

Please sign in to comment.