Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
* 3.0:
  fix: fixed errors for generating reports, closes #1708
  fix: don't show any text if no attached files are available
  fix: added missing fetch of user/group permissions from FAQ, closes #1697
  fix: removed wrong HTTP 403 response, closes #1688
  fix: fixed URL for pagination, closes #1689
  fix: fixed wrong check disabled permissions due to category selection, closes #1675
  feat(admin): added possibility to reset category image, closes #1673
  fix: fixed Markdown editor mode, closes #1674
  fix: cleanup of news code, removed datetime inputs, closes #1670
  • Loading branch information
thorsten committed Apr 10, 2020
2 parents cb230d2 + 0351447 commit 85bb45b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions phpmyfaq/admin/report.export.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@

foreach ($report->getReportingData() as $data) {
$i = $data['faq_id'];
if ($useCategory) {
if (0 != $data['category_parent']) {
if ($useCategory && isset($data['category_name'])) {
if (0 !== $data['category_parent']) {
$text[$i][] = $data['category_parent'];
} else {
$text[$i][] = $report->convertEncoding($data['category_name']);
Expand All @@ -75,7 +75,7 @@
if ($useTranslation) {
$text[$i][] = $data['faq_translations'];
}
if ($useLanguage) {
if ($useLanguage && isset($languageCodes[strtoupper($data['faq_language'])])) {
$text[$i][] = $report->convertEncoding($languageCodes[strtoupper($data['faq_language'])]);
}
if ($useId) {
Expand All @@ -93,7 +93,7 @@
if ($useOwner) {
$text[$i][] = $report->convertEncoding($data['faq_org_author']);
}
if ($useLastModified) {
if ($useLastModified && isset($data['faq_last_author'])) {
$text[$i][] = $report->convertEncoding($data['faq_last_author']);
}
if ($useUrl) {
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/admin/report.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
if ($useTranslation) {
printf('<td>%d</td>', $data['faq_translations']);
}
if ($useLanguage) {
if ($useLanguage && isset($languageCodes[strtoupper($data['faq_language'])])) {
printf('<td>%s</td>', $languageCodes[strtoupper($data['faq_language'])]);
}
if ($useId) {
Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/src/phpMyFAQ/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getReportingData(): array
if ($row->id == $lastId) {
$report[$row->id]['faq_translations'] += 1;
} else {
$report[$row->id] = array(
$report[$row->id] = [
'faq_id' => $row->id,
'faq_language' => $row->lang,
'category_id' => $row->category_id,
Expand All @@ -116,7 +116,7 @@ public function getReportingData(): array
'faq_updated' => Date::createIsoDate($row->updated),
'faq_visits' => $row->visits,
'faq_last_author' => $row->last_author,
);
];
}
$lastId = $row->id;
}
Expand All @@ -131,7 +131,7 @@ public function getReportingData(): array
* @param string $outputString String to encode.
* @return string Encoded string.
*/
public function convertEncoding(string $outputString): string
public function convertEncoding(string $outputString = ''): string
{
$outputString = html_entity_decode($outputString, ENT_QUOTES, 'utf-8');
$outputString = str_replace(',', ' ', $outputString);
Expand Down

0 comments on commit 85bb45b

Please sign in to comment.