getLinks(false); $keywords[] = split_pagename($page->getName()); while ($link = $links->next()) if (preg_match("/${KeywordLinkRegexp}/x", $link->getName(), $m)) $keywords[] = split_pagename($m[0]); $keywords[] = WIKI_NAME; return join(', ', $keywords); } /** Make a link back to redirecting page. * * @param $pagename string Name of redirecting page. * @return XmlContent Link to the redirecting page. */ function RedirectorLink($pagename) { $url = WikiURL($pagename, array('redirectfrom' => '')); return HTML::a(array('class' => 'redirectfrom wiki', 'href' => $url), $pagename); } function actionPage(&$request, $action) { global $Theme; $pagename = $request->getArg('pagename'); $version = $request->getArg('version'); $page = $request->getPage(); $revision = $page->getCurrentRevision(); $dbi = $request->getDbh(); $actionpage = $dbi->getPage($action); $actionrev = $actionpage->getCurrentRevision(); // $splitname = split_pagename($pagename); $pagetitle = HTML(fmt("%s: %s", $actionpage->getName(), $Theme->linkExistingWikiWord($pagename, false, $version))); $validators = new HTTP_ValidatorSet(array('pageversion' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); $request->appendValidators(array('actionpagerev' => $actionrev->getVersion(), '%mtime' => $actionrev->get('mtime'))); $transformedContent = $actionrev->getTransformedContent(); $template = Template('browse', array('CONTENT' => $transformedContent)); header("Content-Type: text/html; charset=" . $GLOBALS['charset']); GeneratePage($template, $pagetitle, $revision); $request->checkValidators(); flush(); } function displayPage(&$request, $template=false) { $pagename = $request->getArg('pagename'); $version = $request->getArg('version'); $page = $request->getPage(); if ($version) { $revision = $page->getRevision($version); if (!$revision) NoSuchRevision($request, $page, $version); } else { $revision = $page->getCurrentRevision(); } $splitname = split_pagename($pagename); if (isSubPage($pagename)) { $pages = explode(SUBPAGE_SEPARATOR,$pagename); $last_page = array_pop($pages); // deletes last element from array as side-effect $pagetitle = HTML::span(HTML::a(array('href' => WikiURL($pages[0]), 'class' => 'pagetitle' ), split_pagename($pages[0] . SUBPAGE_SEPARATOR))); $first_pages = $pages[0] . SUBPAGE_SEPARATOR; array_shift($pages); foreach ($pages as $p) { $pagetitle->pushContent(HTML::a(array('href' => WikiURL($first_pages . $p), 'class' => 'backlinks'), split_pagename($p . SUBPAGE_SEPARATOR))); $first_pages .= $p . SUBPAGE_SEPARATOR; } $backlink = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), split_pagename($last_page)); $backlink->addTooltip(sprintf(_("BackLinks for %s"), $pagename)); $pagetitle->pushContent($backlink); } else { $pagetitle = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $splitname); $pagetitle->addTooltip(sprintf(_("BackLinks for %s"), $pagename)); if ($request->getArg('frame')) $pagetitle->setAttr('target', '_top'); } $pageheader = $pagetitle; if (($redirect_from = $request->getArg('redirectfrom'))) { $redirect_message = HTML::span(array('class' => 'redirectfrom'), fmt("(Redirected from %s)", RedirectorLink($redirect_from))); } $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); // FIXME: should probably be in a template... if ($request->getArg('action') != 'pdf') header("Content-Type: text/html; charset=" . $GLOBALS['charset']); // FIXME: this gets done twice? $page_content = $revision->getTransformedContent(); $toks['CONTENT'] = new Template('browse', $request, $page_content); $toks['TITLE'] = $pagetitle; $toks['HEADER'] = $pageheader; $toks['revision'] = $revision; if (!empty($redirect_message)) $toks['redirected'] = $redirect_message; $toks['ROBOTS_META'] = 'index,follow'; $toks['PAGE_DESCRIPTION'] = $page_content->getDescription(); $toks['PAGE_KEYWORDS'] = GleanKeywords($page); if (!$template) $template = new Template('html', $request); $template->printExpansion($toks); $page->increaseHitCount(); if ($request->getArg('action') != 'pdf') $request->checkValidators(); flush(); } // $Log: not supported by cvs2svn $ // Revision 1.49 2004/04/18 01:11:52 rurban // more numeric pagename fixes. // fixed action=upload with merge conflict warnings. // charset changed from constant to global (dynamic utf-8 switching) // // For emacs users // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>