Skip to content

Commit

Permalink
3.0 (#1662)
Browse files Browse the repository at this point in the history
* Fixed fatal error, closes #1656

* Support usage of external database tools

* fix: fixed issue with URLs behind a proxy, closes #1661
  • Loading branch information
thorsten committed Mar 14, 2020
1 parent 4ca4ef3 commit 406f68a
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions phpmyfaq/admin/attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

$pagination = new Pagination(
$faqConfig,
array(
'baseUrl' => Link::getSystemRelativeUri() . '?' . str_replace('&', '&', $_SERVER['QUERY_STRING']),
[
'baseUrl' => $faqConfig->getDefaultUrl() . '?' . str_replace('&', '&', $_SERVER['QUERY_STRING']),
'total' => count($allCrumbs),
'perPage' => $itemsPerPage,
)
]
);
?>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/admin/stat.adminlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@

$baseUrl = sprintf(
'%s?action=adminlog&amp;page=%d',
Link::getSystemRelativeUri(),
$faqConfig->getDefaultUrl(),
$page
);

// Pagination options
$options = array(
$options = [
'baseUrl' => $baseUrl,
'total' => $logging->getNumberOfEntries(),
'perPage' => $perpage,
'pageParamName' => 'page',
);
];
$pagination = new Pagination($faqConfig, $options);

$loggingData = $logging->getAll();
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/admin/stat.search.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

$baseUrl = sprintf(
'%s?action=searchstats&amp;page=%d',
Link::getSystemRelativeUri(),
$faqConfig->getDefaultUrl(),
$page
);

Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/admin/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ class="form-check-input permission">

$baseUrl = sprintf(
'%s?action=user&amp;user_action=listallusers&amp;page=%d',
Link::getSystemRelativeUri(),
$faqConfig->getDefaultUrl(),
$page
);

Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
if (strpos($_url, '&amp;') === false) {
$_link = str_replace('&', '&amp;', $_link);
}
$oLink = new Link(Link::getSystemRelativeUri() . $_link, $faqConfig);
$oLink = new Link($faqConfig->getDefaultUrl() . $_link, $faqConfig);
$oLink->itemTitle = $oLink->tooltip = $_title;
$newFaqPath = $oLink->toString();
$answer = str_replace($_url, $newFaqPath, $answer);
Expand Down Expand Up @@ -338,7 +338,7 @@
str_replace(
'%',
'%%',
Link::getSystemRelativeUri('index.php')
$faqConfig->getDefaultUrl()
) . 'index.php?%saction=savevoting',
$sids
),
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/glossary.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

$baseUrl = sprintf(
'%s?action=glossary&amp;page=%d',
Link::getSystemRelativeUri(),
$faqConfig->getDefaultUrl(),
$page
);

Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
if ($faqConfig->get('main.enableRewriteRules')) {
$baseUrl = sprintf(
'%ssearch.html?search=%s&amp;seite=%d%s&amp;searchcategory=%d',
Link::getSystemRelativeUri('index.php'),
$faqConfig->getDefaultUrl(),
urlencode($inputSearchTerm),
$page,
$languages,
Expand All @@ -199,7 +199,7 @@
} else {
$baseUrl = sprintf(
'%s?%saction=search&amp;search=%s&amp;seite=%d%s&amp;searchcategory=%d',
Link::getSystemRelativeUri(),
$faqConfig->getDefaultUrl(),
empty($sids) ? '' : 'sids=' . $sids . '&amp;',
urlencode($inputSearchTerm),
$page,
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
if ($categoryData->getParentId() !== 0) {
$url = sprintf(
'%s?%saction=show&amp;cat=%d',
Link::getSystemRelativeUri(),
$faqConfig->getDefaultUrl(),
$sids,
$categoryData->getParentId()
);
Expand Down
8 changes: 4 additions & 4 deletions phpmyfaq/src/phpMyFAQ/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public function getHomeCategories()
}
$result = $this->config->getDb()->query($query);
while ($row = $this->config->getDb()->fetchArray($result)) {
$url = sprintf('%s?action=show&amp;cat=%d', Link::getSystemRelativeUri(), $row['id']);
$url = sprintf('%s?action=show&amp;cat=%d', $this->config->getDefaultUrl(), $row['id']);
$link = new Link($url, $this->config);
$link->itemTitle = $row['name'];
$categories['url'][] = $link->toString();
Expand Down Expand Up @@ -766,7 +766,7 @@ public function viewTree()

$url = sprintf(
'%s?%saction=show&amp;cat=%d',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$parent
);
Expand Down Expand Up @@ -878,7 +878,7 @@ public function addCategoryLink(
) {
$url = sprintf(
'%s?%saction=show&amp;cat=%d',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$categoryId
);
Expand Down Expand Up @@ -980,7 +980,7 @@ public function getPath($id, $separator = ' / ', $renderAsMicroData = false, $us
foreach ($temp as $k => $category) {
$url = sprintf(
'%s?%saction=show&amp;cat=%d',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$catid[$k]
);
Expand Down
22 changes: 11 additions & 11 deletions phpmyfaq/src/phpMyFAQ/Faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public function renderRecordsByCategoryId(int $categoryId, string $orderBy = 'id
$title = $row->thema;
$url = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$row->category_id,
$row->id,
Expand Down Expand Up @@ -479,11 +479,11 @@ public function renderRecordsByCategoryId(int $categoryId, string $orderBy = 'id
if ($pages > 1) {
// Set rewrite URL, if needed
if ($this->config->get('main.enableRewriteRules')) {
$link = new Link(Link::getSystemRelativeUri('index.php'), $this->config);
$link = new Link($this->config->getDefaultUrl(), $this->config);
$useRewrite = true;
$rewriteUrl = sprintf(
'%scategory/%d/%%d/%s.html',
Link::getSystemRelativeUri('index.php'),
$this->config->getDefaultUrl(),
$categoryId,
$link->getSEOItemTitle($title)
);
Expand All @@ -493,7 +493,7 @@ public function renderRecordsByCategoryId(int $categoryId, string $orderBy = 'id
}
$baseUrl = sprintf(
'%s?%saction=show&amp;cat=%d&amp;seite=%d',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
(empty($sids) ? '' : $sids),
$categoryId,
$page
Expand Down Expand Up @@ -640,7 +640,7 @@ public function renderRecordsByFaqIds(array $recordIds, string $orderBy = 'fd.id
$title = $row->thema;
$url = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$row->category_id,
$row->id,
Expand Down Expand Up @@ -674,7 +674,7 @@ public function renderRecordsByFaqIds(array $recordIds, string $orderBy = 'fd.id
$next = $page + 1;
if ($vor != 0) {
$url = $sids . '&amp;action=search&amp;tagging_id=' . $taggingId . '&amp;seite=' . $vor;
$oLink = new Link(Link::getSystemRelativeUri() . '?' . $url, $this->config);
$oLink = new Link($this->config->getDefaultUrl() . '?' . $url, $this->config);
$oLink->itemTitle = 'tag';
$oLink->text = $this->translation['msgPrevious'];
$oLink->tooltip = $this->translation['msgPrevious'];
Expand All @@ -683,7 +683,7 @@ public function renderRecordsByFaqIds(array $recordIds, string $orderBy = 'fd.id
$output .= ' ';
if ($next <= $pages) {
$url = $sids . '&amp;action=search&amp;tagging_id=' . $taggingId . '&amp;seite=' . $next;
$oLink = new Link(Link::getSystemRelativeUri() . '?' . $url, $this->config);
$oLink = new Link($this->config->getDefaultUrl() . '?' . $url, $this->config);
$oLink->itemTitle = 'tag';
$oLink->text = $this->translation['msgNext'];
$oLink->tooltip = $this->translation['msgNext'];
Expand Down Expand Up @@ -2078,7 +2078,7 @@ public function getTopVotedData($count = PMF_NUMBER_RECORDS_TOPTEN, $language =
$title = $row->thema;
$url = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$row->category_id,
$row->id,
Expand Down Expand Up @@ -2622,7 +2622,7 @@ public function getRecordsWithoutPagingByCategoryId(int $categoryId): string
$title = $row->thema;
$url = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$row->category_id,
$row->id,
Expand Down Expand Up @@ -2903,7 +2903,7 @@ public function getStickyRecordsData()
$title = $row->thema;
$url = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$row->category_id,
$row->id,
Expand Down Expand Up @@ -2959,7 +2959,7 @@ public function getInactiveFaqsData()
$data['question'] = $row->thema;
$data['url'] = sprintf(
'%s?action=editentry&id=%d&lang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$row->id,
$row->lang
);
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Helper/CategoryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function renderCategoryDropDown()

$url = sprintf(
'%s?%saction=show&amp;cat=%d',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$parent
);
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Helper/FaqHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function renderChangeLanguageSelector(Faq $faq, $categoryId): string
$faq->faqRecord['id']
);

$oLink = new Link(Link::getSystemRelativeUri() . $faqUrl, $this->config);
$oLink = new Link($this->config->getDefaultUrl() . $faqUrl, $this->config);
$oLink->itemTitle = $faq->faqRecord['title'];
$availableLanguages = $this->config->getLanguage()->languageAvailable($faq->faqRecord['id']);

Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/src/phpMyFAQ/Helper/SearchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function renderInstantResponseResult(SearchResultSet $resultSet): string
// Build the link to the faq record
$currentUrl = sprintf(
'%s?%saction=faq&cat=%d&id=%d&artlang=%s&highlight=%s',
Link::getSystemRelativeUri('ajaxresponse.php') . 'index.php',
$this->config->getDefaultUrl() . 'index.php',
$this->sessionId,
$result->category_id,
$result->id,
Expand Down Expand Up @@ -266,7 +266,7 @@ public function renderSearchResult(SearchResultSet $resultSet, int $currentPage)
// Build the link to the faq record
$currentUrl = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;highlight=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$this->sessionId,
$result->category_id,
$result->id,
Expand Down Expand Up @@ -354,7 +354,7 @@ public function renderRelatedFaqs(SearchResultSet $resultSet, int $recordId): st

$url = sprintf(
'%s?action=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$result->category_id,
$result->id,
$result->lang
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getNews($showArchive = false, $active = true)
foreach ($news as $item) {
$url = sprintf(
'%s?action=news&amp;newsid=%d&amp;newslang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$item['id'],
$item['lang']
);
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function getPdfLink()
{
return sprintf(
'%spdf.php?cat=%d&id=%d&artlang=%s',
Link::getSystemRelativeUri('index.php'),
$this->config->getDefaultUrl(),
$this->getCategoryId(),
$this->getFaqId(),
$this->getLanguage()
Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function getAllFirstLetters(): string
if (Strings::preg_match("/^\w+/iu", $letters)) {
$url = sprintf(
'%s?%saction=sitemap&amp;letter=%s&amp;lang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$letters,
$this->config->getLanguage()->getLanguage()
Expand Down Expand Up @@ -312,7 +312,7 @@ public function getRecordsFromLetter($letter = 'A'): string
$title = Strings::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
$url = sprintf(
'%s?%saction=faq&amp;cat=%d&amp;id=%d&amp;artlang=%s',
Link::getSystemRelativeUri(),
$this->config->getDefaultUrl(),
$sids,
$row->category_id,
$row->id,
Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getAllLinkTagsById(int $recordId): string

foreach ($this->getAllTagsById($recordId) as $taggingId => $taggingName) {
$title = Strings::htmlspecialchars($taggingName, ENT_QUOTES, 'utf-8');
$url = sprintf('%s?action=search&amp;tagging_id=%d', Link::getSystemRelativeUri(), $taggingId);
$url = sprintf('%s?action=search&amp;tagging_id=%d', $this->config->getDefaultUrl(), $taggingId);
$oLink = new Link($url, $this->config);
$oLink->itemTitle = $taggingName;
$oLink->text = $taggingName;
Expand Down Expand Up @@ -429,7 +429,7 @@ public function renderTagCloud()
++$i;
$html .= '<li>';
$title = Strings::htmlspecialchars($tag['name'] . ' (' . $tag['count'] . ')', ENT_QUOTES, 'utf-8');
$url = sprintf('%s?action=search&amp;tagging_id=%d', Link::getSystemRelativeUri(), $tag['id']);
$url = sprintf('%s?action=search&amp;tagging_id=%d', $this->config->getDefaultUrl(), $tag['id']);
$oLink = new Link($url, $this->config);
$oLink->itemTitle = $tag['name'];
$oLink->text = $tag['name'];
Expand Down

0 comments on commit 406f68a

Please sign in to comment.