$quote = $base->getRandomQuote(); $content->assign('random', true); $content->assign('quote', $quote['quote']); $content->assign('id', $quote['id']); $phptemp->assign('page', $quote['id']); $phptemp->assign('thisurl', "//tools.wmflabs.org" . $_SERVER['REQUEST_URI']); break; case 'showall': $quotes = $base->getAllQuotes(); $content->assign('showall', true); $content->assign('quotes', $quotes); break; case 'showone': $quote = $base->getQuoteFromId($wgRequest->getSafeVal('id')); $content->assign('showone', true); $content->assign('quote', $quote['quote']); $content->assign('id', $quote['id']); $phptemp->assign('page', $quote['id']); break; case 'search': $quotes = $base->getQuotesFromSearch($wgRequest->getSafeVal('search'), $wgRequest->getBool('regex')); $content->assign('search', true); $content->assign('quotes', $quotes); if (!count($quotes)) { $content->assign('error', $phptemp->get_config_vars('noresults')); } break; default: WebTool::toDie($phptemp->get_config_vars('invalidaction')); } WebTool::finishScript();
<h3>{#quote_number#} ' . $quote['id'] . '</h3> <pre>' . $quote['quote'] . '</pre> <a href="' . $otherurl . '"> - {#more#} - </a> '; break; case 'showall': $quotes = $base->getAllQuotes(); $pageResult = '<h3>{#quote_showall#}</h3>'; foreach ($quotes as $id => $quote) { $pageResult .= ' <h3>{#quote_number#} ' . $id . '</h3> <pre>' . $quote . '</pre>'; } break; case 'search': $quotes = $base->getQuotesFromSearch($search, $isRegex); $pageResult = '<h3>{#searchresults#}</h3>'; foreach ($quotes as $id => $quote) { $pageResult .= ' <h3>{#quote_number#} ' . $id . '</h3> <pre>' . $quote . '</pre>'; } if (!count($quotes)) { $wt->toDie('noresult', $search); } break; default: $wt->showPage(); } unset($base, $quotes); $wt->content = $pageResult;