Пример #1
0
 function checkLoginMessagesStatus()
 {
     global $wgRequest, $I18N, $perflog;
     $this->statusLink['logo'] = '<a href="//' . XTOOLS_BASE_WEB_DIR . '" >X!\'s Tools</a>';
     $this->statusLink['loginout'] = '<span class="login" ><a href="https://' . XTOOLS_BASE_WEB_DIR . '/oauthredirector.php?action=login&callto=' . (!empty($this->getWikiInfo()->domain) ? "https://" . $this->getWikiInfo()->domain . "/w/api.php" : "https://www.mediawiki.org/w/api.php") . '&returnto=' . $wgRequest->getFullRequestURL() . '" >' . $I18N->msg('login') . '</a></span>';
     $this->statusLink['agentconfig'] = '<a title="XAgent configuration" href="//' . XTOOLS_BASE_WEB_DIR . '/agent/config.php"><img style="vertical-align:baseline" src="//' . XTOOLS_BASE_WEB_DIR . '/static/images/Blue_Fedora_hat_12.png" />{$linktext}</a>&nbsp;&nbsp;';
     $this->statusLink['echo'] = '<a title="Your echo notifications from 800+ wikis" href="//' . XTOOLS_BASE_WEB_DIR . '/echo/"><img style="vertical-align:bottom;padding-right:4px;" src="//' . XTOOLS_BASE_WEB_DIR . '/static/images/Echo_Icon_18.png" />XEcho</a>&nbsp;&nbsp;';
     $this->loggedIn = false;
     $this->loggedInUsername = null;
     if ($this->OAuthObject->isAuthorized()) {
         if ($this->OAuthObject->getUsername()) {
             $this->loggedIn = true;
             $this->statusLink['loginout'] = '<span class="login" ><span style="margin-right:10px;">' . $this->OAuthObject->getUsername() . '</span><a href="https://' . XTOOLS_BASE_WEB_DIR . '/oauthredirector.php?action=logout&callto=' . (!empty($this->getWikiInfo()->domain) ? "https://" . $this->getWikiInfo()->domain . "/w/api.php" : "https://www.mediawiki.org/w/api.php") . '&returnto=' . $wgRequest->getFullRequestURL() . '" >' . $I18N->msg('logout') . '</a></span>';
             $this->loggedInUsername = $this->OAuthObject->getUsername();
         } else {
             $this->loggedInUsername = $this->OAuthObject->getUsername();
         }
         $_SESSION["cacheCtrl"] = "nocacheOnce";
     }
     //&& $this->loggedInUsername == "Hedonil"
     $this->statusLink['message'] = '';
     if ($this->loggedIn && $this->toolConfigTitle != "echo") {
         require_once 'Agent.php';
         $this->statusLink['message'] = getCrossWikiMessage($this);
     }
 }
Пример #2
0
//Requires
require_once '/data/project/xtools/modules/WebTool.php';
require_once 'Agent.php';
//Load WebTool class
$wt = new WebTool('echo');
$wt->setLimits();
$wt->content = getPageTemplate('result');
$purge = $wgRequest->getBool('purge', false);
$wi = $wt->wikiInfo;
$lang = $wi->lang;
$wiki = $wi->wiki;
$domain = $wi->domain;
$list = '<p style="text-align:center"><br/>&nbsp;You are not logged in. <a href="https://' . XTOOLS_BASE_WEB_DIR . '/oauthredirector.php?action=login&returnto=https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" >Log in</a> with secure Wikimedia OAuth.<br/>If necessary, refresh your browser with F5 afterwards.<br />&nbsp;</p>';
//Show form if &article parameter is not set (or empty)
if ($wt->OAuthObject->isAuthorized()) {
    $resArr = getCrossWikiMessage($wt, 'all', 50, $purge);
    $wt->statusLink['message'] = $resArr["list"];
    $msgArr = $resArr["msgArr"];
    uasort($msgArr, function ($al, $bl) {
        $a = $al["timestamp"];
        $b = $bl["timestamp"];
        if ($a == $b) {
            return 0;
        }
        return $a < $b ? 1 : -1;
    });
    #$perflog->stack[] = $msgArr;
    $list = '
				<tr>
				<th>Wiki</th>
				<th>Notification time</th>