/** * Display */ public function display() { echo '<div class="panel-heading">'; echo HTML::h1(__('Export your training')); echo '</div>'; echo '<div class="panel-content">'; if ($this->exporterIsChosen()) { $this->displayChosenExporter(); } else { $this->displayExporterList(); } echo '</div>'; }
function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); $output = HTML(HTML::h1("Group Info")); $group = WikiGroup::getGroup(); $allGroups = $group->getAllGroupsIn(); foreach ($allGroups as $g) { $members = $group->getMembersOf($g); $output->pushContent(HTML::h3($g . " - members: " . sizeof($members) . " - isMember: " . ($group->isMember($g) ? "yes" : "no"))); foreach ($members as $m) { $output->pushContent($m); $output->pushContent(HTML::br()); } } $output->pushContent(HTML::p("--- the end ---")); return $output; }
function displayPage(&$request, $template = false) { global $WikiTheme, $pv; $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(); } if (isSubPage($pagename)) { $pages = explode(SUBPAGE_SEPARATOR, $pagename); $last_page = array_pop($pages); // deletes last element from array as side-effect $pageheader = HTML::span(HTML::a(array('href' => WikiURL($pages[0]), 'class' => 'pagetitle'), $WikiTheme->maybeSplitWikiWord($pages[0] . SUBPAGE_SEPARATOR))); $first_pages = $pages[0] . SUBPAGE_SEPARATOR; array_shift($pages); foreach ($pages as $p) { if ($pv != 2) { //Add the Backlink in page title $pageheader->pushContent(HTML::a(array('href' => WikiURL($first_pages . $p), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($p . SUBPAGE_SEPARATOR))); } else { // Remove Backlinks $pageheader->pushContent(HTML::h1($pagename)); } $first_pages .= $p . SUBPAGE_SEPARATOR; } if ($pv != 2) { $backlink = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($last_page)); $backlink->addTooltip(sprintf(_("BackLinks for %s"), $pagename)); } else { $backlink = HTML::h1($pagename); } $pageheader->pushContent($backlink); } else { if ($pv != 2) { $pageheader = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($pagename)); $pageheader->addTooltip(sprintf(_("BackLinks for %s"), $pagename)); } else { $pageheader = HTML::h1($pagename); //Remove Backlinks } if ($request->getArg('frame')) { $pageheader->setAttr('target', '_top'); } } // {{{ Codendi hook to insert stuff between navbar and header $eM =& EventManager::instance(); $ref_html = ''; $crossref_fact = new CrossReferenceFactory($pagename, ReferenceManager::REFERENCE_NATURE_WIKIPAGE, GROUP_ID); $crossref_fact->fetchDatas(); if ($crossref_fact->getNbReferences() > 0) { $ref_html .= '<h3>' . $GLOBALS['Language']->getText('cross_ref_fact_include', 'references') . '</h3>'; $ref_html .= $crossref_fact->getHTMLDisplayCrossRefs(); } $additional_html = false; $eM->processEvent('wiki_before_content', array('html' => &$additional_html, 'group_id' => GROUP_ID, 'wiki_page' => $pagename)); if ($additional_html) { $beforeHeader = HTML(); $beforeHeader->pushContent($additional_html); $beforeHeader->pushContent(HTML::raw($ref_html)); $toks['BEFORE_HEADER'] = $beforeHeader; } else { $beforeHeader = HTML(); $beforeHeader->pushContent(HTML::raw($ref_html)); $toks['BEFORE_HEADER'] = $beforeHeader; } // }}} /Codendi hook $pagetitle = SplitPagename($pagename); if ($redirect_from = $request->getArg('redirectfrom')) { $redirect_message = HTML::span(array('class' => 'redirectfrom'), fmt("(Redirected from %s)", RedirectorLink($redirect_from))); // abuse the $redirected template var for some status update notice } elseif ($request->getArg('errormsg')) { $redirect_message = $request->getArg('errormsg'); $request->setArg('errormsg', false); } $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); /* // FIXME: This is also in the template... if ($request->getArg('action') != 'pdf' and !headers_sent()) { // FIXME: enable MathML/SVG/... support if (ENABLE_XHTML_XML and (!isBrowserIE() and strstr($request->get('HTTP_ACCEPT'),'application/xhtml+xml'))) header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']); else header("Content-Type: text/html; charset=" . $GLOBALS['charset']); } */ $page_content = $revision->getTransformedContent(); // if external searchengine (google) referrer, highlight the searchterm // FIXME: move that to the transformer? // OR: add the searchhightplugin line to the content? if ($result = isExternalReferrer($request)) { if (DEBUG and !empty($result['query'])) { //$GLOBALS['SearchHighlightQuery'] = $result['query']; /* simply add the SearchHighlight plugin to the top of the page. This just parses the wikitext, and doesn't highlight the markup */ include_once 'lib/WikiPlugin.php'; $loader = new WikiPluginLoader(); $xml = $loader->expandPI('<' . '?plugin SearchHighlight s="' . $result['query'] . '"?' . '>', $request, $markup); if ($xml and is_array($xml)) { foreach (array_reverse($xml) as $line) { array_unshift($page_content->_content, $line); } array_unshift($page_content->_content, HTML::div(_("You searched for: "), HTML::strong($result['query']))); } if (0) { /* Parse the transformed (mixed HTML links + strings) lines? This looks like overkill. */ require_once "lib/TextSearchQuery.php"; $query = new TextSearchQuery($result['query']); $hilight_re = $query->getHighlightRegexp(); //$matches = preg_grep("/$hilight_re/i", $revision->getContent()); // FIXME! for ($i = 0; $i < count($page_content->_content); $i++) { $found = false; $line = $page_content->_content[$i]; if (is_string($line)) { while (preg_match("/^(.*?)({$hilight_re})/i", $line, $m)) { $found = true; $line = substr($line, strlen($m[0])); $html[] = $m[1]; // prematch $html[] = HTML::strong(array('class' => 'search-term'), $m[2]); // match } } if ($found) { $html[] = $line; // postmatch $page_content->_content[$i] = HTML::span(array('class' => 'search-context'), $html); } } } } } $toks['CONTENT'] = new Template('browse', $request, $page_content); $toks['TITLE'] = $pagetitle; // <title> tag $toks['HEADER'] = $pageheader; // h1 with backlink $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(); }
<?php /** * Delete Account * Call: call/window.delete.php */ require '../inc/class.Frontend.php'; $Frontend = new Frontend(); $Errors = array(); AccountHandler::setAndSendDeletionKeyFor($Errors); echo HTML::h1(__('Delete your account.')); if (!empty($Errors)) { foreach ($Errors as $Error) { echo HTML::error($Error); } } else { echo HTML::info(__('<em>A confirmation has been sent via mail.</em><br>' . 'How sad, that you\'ve decided to delete your account.<br>' . 'Your account will be deleted as soon as you click on the confirmation link in your mail.')); }
function checkEmailConfirmation() { global $request; $wikidb = $request->getDbh(); $data = $wikidb->get('ConfirmEmail'); $id = $request->getArg('id'); if (empty($data[$id])) { // id not found return HTML(HTML::h1("Confirm E-mail address"), HTML::h1("Sorry! Wrong URL")); } // upgrade the user $userid = $data['userid']; $email = $data['email']; $u = $request->getUser(); if ($u->UserName() == $userid) { // lucky: current user (session) $prefs = $u->getPreferences(); $request->_user->_level = WIKIAUTH_USER; $request->_prefs->set('emailVerified', true); } else { // not current user if (ENABLE_USER_NEW) { $u = WikiUser($userid); $u->getPreferences(); $prefs =& $u->_prefs; } else { $u = new WikiUser($request, $userid); $prefs = $u->getPreferences(); } $u->_level = WIKIAUTH_USER; $request->setUser($u); $request->_prefs->set('emailVerified', true); } unset($data[$id]); $wikidb->set('ConfirmEmail', $data); return HTML(HTML::h1("Confirm E-mail address"), HTML::p("Your e-mail address has now been confirmed.")); }
/** * Display heading */ protected function displayHeading() { echo HTML::h1(__('Prognosis calculator')); }
/** * Throw error: This training is private */ protected function throwErrorForPrivateTraining() { echo HTML::h1(__('Error')); echo HTML::error(sprintf('<strong>%s</strong>', __('Private activity')) . '<br><br>' . __('This activity is private. The user does not allow you to see it.')); $this->displayLinkToRunalyze(); }
/** * Display header */ private function displayHeader() { echo '<div class="panel-heading">'; echo '<div class="panel-menu">'; echo $this->getNavigationMenu(); echo '</div>'; echo HTML::h1($this->getTitle() . ' ' . $this->getTitleAppendix()); echo '</div>'; }
function editPage() { global $WikiTheme; $saveFailed = false; $tokens =& $this->tokens; $tokens['PAGE_LOCKED_MESSAGE'] = ''; $tokens['CONCURRENT_UPDATE_MESSAGE'] = ''; $r =& $this->request; if (isset($r->args['pref']['editWidth']) and $r->getPref('editWidth') != $r->args['pref']['editWidth']) { $r->_prefs->set('editWidth', $r->args['pref']['editWidth']); } if (isset($r->args['pref']['editHeight']) and $r->getPref('editHeight') != $r->args['pref']['editHeight']) { $r->_prefs->set('editHeight', $r->args['pref']['editHeight']); } if (!$this->canEdit()) { if ($this->isInitialEdit()) { return $this->viewSource(); } $tokens['PAGE_LOCKED_MESSAGE'] = $this->getLockedMessage(); } elseif ($r->getArg('save_and_redirect_to') != "") { if (ENABLE_CAPTCHA && $this->Captcha->Failed()) { $this->tokens['PAGE_LOCKED_MESSAGE'] = HTML::p(HTML::h1($this->Captcha->failed_msg)); } elseif ($this->savePage()) { // noreturn $r->redirect(WikiURL($r->getArg('save_and_redirect_to'))); return true; // Page saved. } $saveFailed = true; } elseif ($this->editaction == 'save') { if (ENABLE_CAPTCHA && $this->Captcha->Failed()) { $this->tokens['PAGE_LOCKED_MESSAGE'] = HTML::p(HTML::h1($this->Captcha->failed_msg)); } elseif ($this->savePage()) { return true; // Page saved. } else { $saveFailed = true; } } if ($saveFailed and $this->isConcurrentUpdate()) { // Get the text of the original page, and the two conflicting edits // The diff3 class takes arrays as input. So retrieve content as // an array, or convert it as necesary. $orig = $this->page->getRevision($this->_currentVersion); // FIXME: what if _currentVersion has be deleted? $orig_content = $orig->getContent(); $this_content = explode("\n", $this->_content); $other_content = $this->current->getContent(); include_once "lib/diff3.php"; $diff = new diff3($orig_content, $this_content, $other_content); $output = $diff->merged_output(_("Your version"), _("Other version")); // Set the content of the textarea to the merged diff // output, and update the version $this->_content = implode("\n", $output); $this->_currentVersion = $this->current->getVersion(); $this->version = $this->_currentVersion; $unresolved = $diff->ConflictingBlocks; $tokens['CONCURRENT_UPDATE_MESSAGE'] = $this->getConflictMessage($unresolved); } elseif ($saveFailed && !$this->_isSpam) { $tokens['CONCURRENT_UPDATE_MESSAGE'] = HTML(HTML::h2(_("Some internal editing error")), HTML::p(_("Your are probably trying to edit/create an invalid version of this page.")), HTML::p(HTML::em(_("&version=-1 might help.")))); } if ($this->editaction == 'edit_convert') { $tokens['PREVIEW_CONTENT'] = $this->getConvertedPreview(); } if ($this->editaction == 'preview') { $tokens['PREVIEW_CONTENT'] = $this->getPreview(); } // FIXME: convert to _MESSAGE? // FIXME: NOT_CURRENT_MESSAGE? $tokens = array_merge($tokens, $this->getFormElements()); if (ENABLE_EDIT_TOOLBAR) { include_once "lib/EditToolbar.php"; $toolbar = new EditToolbar(); $tokens = array_merge($tokens, $toolbar->getTokens()); } return $this->output('editpage', _("Edit: %s")); }
function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); $page = $dbi->getPage($pagename); $current = $page->getCurrentRevision(); $source = $current->getPackedContent(); if (empty($source)) { return $this->error(fmt("empty source")); } if ($basepage == _("SpellCheck")) { return $this->error(fmt("Cannot SpellCheck myself")); } $lang = $page->get('lang'); if (empty($lang)) { $lang = $GLOBALS['LANG']; } $html = HTML(); if (!function_exists('pspell_new_config')) { // use the aspell commandline interface include_once "lib/WikiPluginCached.php"; $args = ""; $source = preg_replace("/^/m", "^", $source); if (ASPELL_DATA_DIR) { $args .= " --data-dir=" . ASPELL_DATA_DIR; } // MAYBE TODO: do we have the language dictionary? $args .= " --lang=" . $lang; // use -C or autosplit wikiwords in the text $commandLine = ASPELL_EXE . " -a -C {$args} "; $cache = new WikiPluginCached(); $code = $cache->filterThroughCmd($source, $commandLine); if (empty($code)) { return $this->error(fmt("Couldn't start commandline '%s'", $commandLine)); } $sugg = array(); foreach (preg_split("/\n/", $code) as $line) { if (preg_match("/^& (\\w+) \\d+ \\d+: (.+)\$/", $line, $m)) { $sugg[$m[1]] = preg_split("/, /", $m[2]); } } /*$pre = HTML::pre(HTML::raw($code)); $html->pushContent($pre);*/ } else { $sugg = pspell_check($source, $lang); } //$html->pushContent(HTML::hr(),HTML::h1(_("Spellcheck"))); $page = $request->getPage(); if ($version) { $revision = $page->getRevision($version); if (!$revision) { NoSuchRevision($request, $page, $version); } } else { $revision = $page->getCurrentRevision(); } $GLOBALS['request']->setArg('suggestions', $sugg); include_once "lib/BlockParser.php"; $ori_html = TransformText($revision, $revision->get('markup'), $page); $GLOBALS['request']->setArg('suggestions', false); $html->pushContent($ori_html, HTML::hr(), HTML::h1(_("SpellCheck result"))); $list = HTML::ul(); foreach ($sugg as $word => $suggs) { $w = HTML::span(array('class' => 'spell-wrong'), $word); // TODO: optional replace-link. jscript or request button with word replace. $r = HTML(); foreach ($suggs as $s) { $r->pushContent(HTML::a(array('class' => 'spell-sugg', 'href' => "javascript:do_replace('{$word}','{$s}')"), $s), ", "); } $list->pushContent(HTML::li($w, ": ", $r)); } $html->pushContent($list); return $html; }
/** * Display header */ protected function displayHeader() { echo HTML::h1(sprintf(__('VDOT calculation for: %s'), $this->Context->dataview()->titleWithComment())); }
function run($dbi, $argstr, &$request, $basepage) { /* ignore fatal on loading */ /* global $ErrorManager; $ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler')); */ // Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki. // see doc/README.foaf if (findFile('XML/FOAF/Parser.php', 'missing_ok')) { require_once 'XML/FOAF/Parser.php'; } //$ErrorManager->popErrorHandler(); if (!class_exists('XML_FOAF_Parser')) { return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path")); } extract($this->getArgs($argstr, $request)); // Get our FOAF File from the foaf plugin argument or $_GET['foaf'] if (empty($foaf)) { $foaf = $request->getArg('foaf'); } $chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF")))); if (empty($foaf)) { return $chooser; } else { //Error Checking if (substr($foaf, 0, 7) != "http://") { return $this->error(_("foaf must be a URI starting with http://")); } // Start of output if (!empty($original)) { $request->redirect($foaf); } else { $foaffile = url_get_contents($foaf); if (!$foaffile) { //TODO: get errormsg return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!")); } // Create new Parser object $parser = new XML_FOAF_Parser(); // Parser FOAF into $foaffile $parser->parseFromMem($foaffile); $a = $parser->toArray(); $html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF")))))); if (DEBUG) { $html->pushContent(HTML::hr(), $chooser); } return $html; } } }
/** * Throw error: This training is private */ protected function throwErrorForPrivateList() { echo HTML::h1(__('Error')); echo HTML::error(sprintf('<strong>%s</strong>', __('This list is private')) . '<br><br>' . __('The user does not share his activity list.')); $this->displayLinkToRunalyze(); }
function run($dbi, $argstr, &$request, $basepage) { // flag that the output may not be cached - i.e. it is dynamic $request->setArg('nocache', 1); if (!$request->_user->isAdmin()) { return HTML::p(_("The requested information is available only to Administrators.")); } if (!ACCESS_LOG_SQL) { // need read access return HTML::p(_("The SQL_ACCESS_LOG is not enabled.")); } // set aside a place for the table headers, see _setHeaders() $this->_theadrow = HTML::tr(); $this->_headerSet = false; $args = $this->getArgs($argstr, $request); $query = $this->_getQueryString($args); if ($query == '') { return HTML::p(sprintf(_("Unrecognised parameter 'mode=%s'"), $args['mode'])); } // get the data back. // Note that this must be done before the final generation ofthe table, // otherwise the headers will not be ready $tbody = $this->_getQueryResults($query, $dbi); return HTML::table(array('border' => 1, 'cellspacing' => 1, 'cellpadding' => 1), HTML::caption(HTML::h1(HTML::br(), $this->_getCaption($args))), HTML::thead($this->_theadrow), $tbody); }
function table_output() { $query = $this->_getQueryString($args); if ($query == '') { return HTML::p(sprintf(_("Unrecognised parameter 'mode=%s'"), $args['mode'])); } // get the data back. // Note that this must be done before the final generation ofthe table, // otherwise the headers will not be ready $tbody = $this->_getQueryResults($query, $dbi); return HTML::table(array('border' => 1, 'cellspacing' => 1, 'cellpadding' => 1), HTML::caption(HTML::h1(HTML::br(), $this->_getCaption($args))), HTML::thead($this->_theadrow), $tbody); }