Exemplo n.º 1
0
ini_set("display_errors", 1);
//Requires
require_once '/data/project/xtools/public_html/WebTool.php';
require_once '/data/project/xtools/public_html/bash/base.php';
//Load WebTool class
$wt = new WebTool('Bash', 'bash', array('getwikiinfo', 'peachy', 'database'));
/*UPDATE ME*/
$wtSource = "//code.google.com/p/soxred93tools/source/browse/trunk/web/bash";
$wtTranslate = true;
WebTool::setMemLimit();
//Show form if &article parameter is not set (or empty)
if (!$wgRequest->getSafeVal('getBool', 'action')) {
    $content->assign('form', true);
    WebTool::assignContent();
}
$base = new BashBase();
switch ($wgRequest->getSafeVal('action')) {
    case 'random':
        $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':
Exemplo n.º 2
0
<?php

//Requires
require_once '/data/project/xtools/modules/WebTool.php';
require_once 'base.php';
//Load WebTool class
$wt = new WebTool('Bash', 'bash', array());
$base = new BashBase();
$wt->content = getPageTemplate('form');
$search = $wgRequest->getVal('search');
$isRegex = $wgRequest->getBool('regex');
//Show form if &article parameter is not set (or empty)
if (!$wgRequest->getVal('action')) {
    $wt->showPage();
}
switch ($wgRequest->getVal('action')) {
    case 'random':
        $quote = $base->getRandomQuote();
        $otherurl = "//tools.wmflabs.org" . $_SERVER['REQUEST_URI'];
        $pageResult = '
				<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>