diff --git a/app/controllers/wiki.php b/app/controllers/wiki.php index 0acc3299cacaaf58a41da8ebae913ec4b1ad58be..95e38465b99167c8b9700e089d36811b7886a0fd 100644 --- a/app/controllers/wiki.php +++ b/app/controllers/wiki.php @@ -297,6 +297,10 @@ class WikiController extends AuthenticatedController "function() {jQuery(this).closest('form').submit();}" ); + $this->show_wiki_page_form = false; + $this->bad_course_search = false; + $this->success = false; + //The following steps are identical for the search and the import. if (Request::submitted('selected_course_id') || Request::submitted('import')) { CSRFProtection::verifyUnsafeRequest(); diff --git a/lib/classes/StudipCoreFormat.php b/lib/classes/StudipCoreFormat.php index 665bb376dd91a5166cbc6739b718952c3b6e0d35..15794bfb33f587085023cedabd55534274fb70ea 100644 --- a/lib/classes/StudipCoreFormat.php +++ b/lib/classes/StudipCoreFormat.php @@ -393,6 +393,8 @@ class StudipCoreFormat extends TextFormat $rows = explode("\n", rtrim($matches[0])); $indent = 0; + $result = ''; + foreach ($rows as $row) { list($level, $text) = explode(' ', $row, 2); $level = mb_strlen($level); diff --git a/lib/classes/WikiFormat.php b/lib/classes/WikiFormat.php index a66974003e61bdfd28cefe3cf0eceea5d8f38792..262ab65cc9388ac2c58778b88ba8f18553a9bc0b 100644 --- a/lib/classes/WikiFormat.php +++ b/lib/classes/WikiFormat.php @@ -17,10 +17,13 @@ class WikiFormat extends StudipFormat private static $wiki_rules = [ 'wiki-comments' => [ 'start' => '\[comment(=.*?)\](.*?)\[\/comment\]', - 'callback' => 'WikiFormat::markupWikiComments' + 'end' => '', + 'callback' => 'WikiFormat::markupWikiComments', + 'before' => '' ], 'wiki-links' => [ 'start' => '\[\[(.*?)(?:\|(.*?))?\]\]', + 'end' => '', 'callback' => 'WikiFormat::markupWikiLinks', 'before' => 'links' ], @@ -143,7 +146,7 @@ class WikiFormat extends StudipFormat protected static function markupWikiLinks($markup, $matches) { $keyword = decodeHTML($matches[1]); - $display_page = $matches[2] ? $markup->format($matches[2]) : htmlReady($keyword); + $display_page = !empty($matches[2]) ? $markup->format($matches[2]) : htmlReady($keyword); $page = WikiPage::findLatestPage(Context::getId(), $keyword); diff --git a/lib/wiki.inc.php b/lib/wiki.inc.php index 9f11672ab5cc82dd1154a7c8e5a04e83699bdefc..71b8e9c242338b3b81c3124357cfda9f0e65cb40 100644 --- a/lib/wiki.inc.php +++ b/lib/wiki.inc.php @@ -179,7 +179,7 @@ function keywordExists($str, $sem_id = null) { $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES)); $nonhtmlstr = strtr($str, $trans_tbl); - return $keywords[$nonhtmlstr]; + return $keywords[$nonhtmlstr] ?? false; } @@ -758,6 +758,7 @@ function searchWiki($searchfor, $searchcurrentversions, $keyword, $localsearch) { $range_id = Context::getId(); $result = null; + $invalid_searchstring = false; // check for invalid search string if (mb_strlen($searchfor) < 3) { @@ -953,6 +954,7 @@ function searchWiki($searchfor, $searchcurrentversions, $keyword, $localsearch) **/ function wikiEdit($keyword, $wikiData, $user_id, $backpage=NULL, $ancestor=NULL) { + $parent = null; if (!$wikiData || $wikiData->isNew()) { $body = ''; $version = 0; @@ -1005,8 +1007,9 @@ function wikiEdit($keyword, $wikiData, $user_id, $backpage=NULL, $ancestor=NULL) } // Action menu for content bar. + $actionMenu = ActionMenu::get(); if ($page && $page->isLatestVersion()) { - $actionMenu = ActionMenu::get()->setContext($page->keyword); + $actionMenu->setContext($page->keyword); if ($page->isEditableBy($GLOBALS['user'])) { if (!$page->isNew()) { $actionMenu->addLink( @@ -1103,6 +1106,7 @@ function exportAllWikiPagesPDF($mode, $sortby) $versionsortlink = 'version'; $changesortlink = 'lastchange'; + $sort = ''; switch ($sortby) { case 'title': // sort by keyword, prepare link for descending sorting @@ -1512,7 +1516,7 @@ function get_toc_content() { } $toccont = '<div class="wikitoc" id="00toc">'; - $toccont .= wikiReady($toc['body'], true, false, $show_comments); + $toccont .= wikiReady($toc['body'], true); $toccont .= '</div>'; return $toccont; } @@ -1557,8 +1561,9 @@ function showWikiPage($keyword, $version, $special="", $show_comments="icon", $h } // Action menu for content bar. + $actionMenu = ActionMenu::get(); if ($page && $page->isLatestVersion()) { - $actionMenu = ActionMenu::get()->setContext($page->keyword); + $actionMenu->setContext($page->keyword); if ($page->isEditableBy($GLOBALS['user'])) { if (!$page->isNew()) { $actionMenu->addLink( diff --git a/templates/layouts/base.php b/templates/layouts/base.php index 42f5b0dfb02ae8b3f68dbd45f0a0e3661d706d6c..2528a642bfa86aa267c5a7a80a3a07429f6a3868 100644 --- a/templates/layouts/base.php +++ b/templates/layouts/base.php @@ -112,7 +112,7 @@ $getInstalledLanguages = function () { (Navigation::hasItem('/admin/institute') && Navigation::getItem('/admin/institute')->isActive())); ?> <div id="layout_page" <? if (!($contextable)) echo 'class="contextless"'; ?>> - <? if (PageLayout::isHeaderEnabled() && Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive() && $_SESSION['seminar_change_view_'.Context::getId()]) : ?> + <? if (PageLayout::isHeaderEnabled() && Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive() && !empty($_SESSION['seminar_change_view_'.Context::getId()])) : ?> <?= $this->render_partial('change_view', ['changed_status' => $_SESSION['seminar_change_view_'.Context::getId()]]) ?> <? endif ?>