Пример #1
0
    if (!$page_id || $page_id == 0) {
        $wt->toDie('nosuchpage', $page . " ({$domain})");
    }
    $list = getPageEditsPerUser($dbr, $page_id, $domain, $users, $wi);
    $wt->content = getPageTemplate('resultpage');
    $userprefix = '';
} else {
    $cnt = new Counter($dbr, $user, $domain, true);
    if ($cnt->optin) {
        $wt->content = getPageTemplate('resultns');
        $nscolon = $page_title = "";
        $nsnames = $cnt->getNamespaces();
        $list = getTopEditsByNamespace($dbr, $wi, $ui, $nsnames, $namespace);
    } else {
        $nsnames = $cnt->getNamespaces();
        $wt->content = getPageTemplate('resultns');
        $list = $I18N->msg("nograph", array("variables" => array($cnt->getOptinLinkLocal(), $cnt->getOptinLinkGlobal()))) . "<br /> " . $I18N->msg('nograph2', array("variables" => array($wt->linkOauthHelp)));
    }
    $userprefix = $nsnames["names"][2];
}
$wt->assign('list', $list);
$wt->assign('page', $nscolon . $page_title);
$wt->assign('urlencodedpage', rawurlencode(str_replace(" ", "_", $nscolon . $page_title)));
$wt->assign('xtoolsbase', XTOOLS_BASE_WEB_DIR);
$wt->assign('lang', $lang);
$wt->assign('wiki', $wiki);
$wt->assign('domain', $domain);
$wt->assign('username', $user);
$wt->assign('userprefix', $userprefix);
$wt->assign('usernameurl', $ui->userUrl);
unset($cnt, $list);
Пример #2
0
    $wt->showPage();
}
$dbr = $wt->loadDatabase($lang, $wiki);
$cnt = new Counter($dbr, $user, $domain, true);
//Start doing the DB request
$data = $cnt->calcAutoEditsDB($dbr, $begin, $end);
$list = '';
foreach ($data["tools"] as $toolname => $count) {
    $list .= '
				<tr>
				<td><a href="//en.wikipedia.org/wiki/' . Counter::$AEBTypes[$toolname]["shortcut"] . '">' . $toolname . '</a></td>
				<td class="tdnum" >' . $wt->numFmt($count) . '</td>
				</tr>
			';
}
$wt->content = getPageTemplate("result");
$wt->assign('list', $list);
$wt->assign('username', $user);
$wt->assign('usernameurl', rawurlencode($user));
$wt->assign('domain', $domain);
$wt->assign('lang', $lang);
$wt->assign('wiki', $wiki);
$wt->assign('start', $data['start']);
$wt->assign('end', $data['end']);
$wt->assign('totalauto', $wt->numFmt($data['total']));
$wt->assign('totalall', $wt->numFmt($data['editcount']));
$wt->assign('pct', $wt->numFmt($data['pct'], 1));
unset($cnt, $data, $list);
$wt->showPage();
/**************************************** templates ****************************************
 * 
Пример #3
0
                        $pageList[$i]["lastcomment"] = $row->revisions[0]->comment;
                        $pageList[$i]["url"] = str_replace('http://', '', $row->fullurl);
                    }
                }
            }
            #print_r($res);
        }
        $result = json_encode($pageList);
        header('Content-Type: application/json; charset=utf-8');
        echo $result;
        exit;
    }
}
//****************************************************++ non-api ************************************************************
#print_r(session_id());
$wt->content = getPageTemplate();
#print_r($_SESSION);
$wt->sitenotice = null;
$wt->moreheader = '
		<script type="text/javascript" src="//' . XTOOLS_BASE_WEB_DIR . '/static/js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript" src="//' . XTOOLS_BASE_WEB_DIR . '/static/js/unserialize.jquery.1.0.2.js"></script>
		<script type="text/javascript" src="//' . XTOOLS_BASE_WEB_DIR . '/static/js/xagent.js?v10"></script>
	';
$langOptions = '<option value="default">default</option>';
foreach ($wt->i18Langs as $langCode => $langName) {
    $langOptions .= "<option value=\"{$langCode}\">{$langName}</option>";
}
$autowikilist = '<p style="text-align:center"><br/>&nbsp;You are not logged in. <a href="//tools.wmflabs.org/xtools/?login" >Log in</a> with secure Wikimedia OAuth.<br/>&nbsp;</p>';
if ($wt->loggedInUsername) {
    $autowiki = getUserActivity($wt, $wt->loggedInUsername);
    $autowikilist = '<table class="table-condensed table-striped xt-table">';
Пример #4
0
///If it reaches here, means the page requested is valid. Log the information for future use.
logInfo(getUserEmail($userId), $userId, $pageId, $pageFullPath, getPageModule($pageId), $action, $_SERVER['REMOTE_ADDR']);
///The URL points to a file. Download permissions for the file are handled inside the download() function in download.lib.php
if (isset($_GET['fileget'])) {
    require_once $sourceFolder . "/download.lib.php";
    $action = "";
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    download($pageId, $userId, $_GET['fileget'], $action);
    exit;
}
///Check whether the user has the permission to use that action on the requested page.
$permission = getPermissions($userId, $pageId, $action);
///Gets the page-specific template for that requested page
define("TEMPLATE", getPageTemplate($pageId));
///Gets the page title of the requested page
if (getTitle($pageId, $action, $TITLE)) {
    $TITLE = CMS_TITLE . " - {$TITLE}";
} else {
    $TITLE = CMS_TITLE;
}
///Gets the content according to the user's permissions
$CONTENT = getContent($pageId, $action, $userId, $permission);
///Gets the inherited code (if any) from the parent page
$INHERITEDINFO = inheritedinfo($pageIdArray);
///Gets the breadcrumb
$BREADCRUMB = breadcrumbs($pageIdArray, "&nbsp;»&nbsp;");
//Gets the searchbar
$SEARCHBAR = getSearchbar($userId, $pageId);
//Gets the page-speciit keywords
Пример #5
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>