//'<div style="font-family:sans-serif,Arial,Helvettica; font-size: 10pt">';
 $followlastrun = $user->followlastrun;
 $now = time();
 if ($followlastrun == 0) {
     $timeback = 3600;
     //3600 = 1 hour
     $followlastrun = $now - $timeback;
 }
 // GET PEOPLE THEY FOLLOW
 $followingusers = getUsersBeingFollowedByMe($userid);
 $countj = count($followingusers);
 for ($j = 0; $j < $countj; $j++) {
     $next = $followingusers[$j];
     $name = $next['Name'];
     $nextuserid = $next['UserID'];
     $as = getUserActivity($nextuserid, $followlastrun);
     if ($as->totalno > 0) {
         $nextMessage .= '<br />' . $LNG->ADMIN_CRON_FOLLOW_USER_ACTIVITY_MESSAGE . ' <span style="font-weight:bold">' . $name . '</span>: <a href="' . $CFG->homeAddress . 'ui/popups/activityviewerusers.php?userid=' . $nextuserid . '&fromtime=' . $followlastrun . '">' . $LNG->ADMIN_CRON_FOLLOW_SEE_ACTIVITY_LINK . '</a>';
     }
 }
 // GET ITEMS THEY FOLLOW
 $itemArray = getItemsBeingFollowedByMe($userid);
 $k = 0;
 $countk = count($itemArray);
 for ($k = 0; $k < $countk; $k++) {
     $array = $itemArray[$k];
     $nodeid = $array['NodeID'];
     $nodename = $array['Name'];
     $nodetype = $array['NodeType'];
     $as = getNodeActivity($nodeid, $followlastrun, false);
     $activities = $as->activities;
 ********************************************************************************/
include_once "../../config.php";
$me = substr($_SERVER["PHP_SELF"], 1);
// remove initial '/'
if ($HUB_FLM->hasCustomVersion($me)) {
    $path = $HUB_FLM->getCodeDirPath($me);
    include_once $path;
    die;
}
array_push($HEADER, '<script src="' . $HUB_FLM->getCodeWebPath('ui/users.js.php') . '" type="text/javascript"></script>');
checkLogin();
include_once $HUB_FLM->getCodeDirPath("ui/headerdialog.php");
$userid = required_param("userid", PARAM_ALPHANUMEXT);
$fromtime = optional_param("fromtime", "0", PARAM_TEXT);
$user = getUser($userid);
$as = getUserActivity($userid, $fromtime, 0, -1);
$activities = $as->activities;
$userObj = json_encode($user);
echo "<script type='text/javascript'>";
echo "var user = "******";";
echo "</script>";
?>
<script type="text/javascript">
	var activityitems = new Object();
	var useritems = new Object();
	useritems['usermain'] = renderWidgetUser(user);
</script>

<div id="activitydiv">
Beispiel #3
0
function getCrossWikiMessage($wt, $type = 'agent', $limit = 5, $forceRefresh = false)
{
    global $perflog, $redis, $wgRequest;
    if (!$wt->OAuthObject->isAuthorized()) {
        return null;
    }
    $wikiArr = getUserActivity($wt);
    $msgwrap1 = '<li class="mw-echo-notification" ><div class="mw-echo-notification-wrapper" style="padding-bottom:7px;border-bottom: 1px solid rgb(221, 221, 221);" >';
    $msgwrap2 = '</div></li>';
    $ttl = 300;
    $hash = session_id() . XTOOLS_REDIS_FLUSH_TOKEN . "03" . hash('crc32', "xtoolsMSG1" . $wt->OAuthObject->getUsername());
    $lc = $redis->get($hash);
    if ($lc === false || $forceRefresh) {
        if ($type == 'agent') {
            $wikis = $wikiArr["topwikis"];
            $wikis = mergeCustomWikis($wt, $wikis);
            $limit = 5;
        } elseif ($type == "all") {
            $wikis = $wikiArr["allwikis"];
        }
        $data = array('action' => 'query', 'meta' => 'notifications', 'format' => 'json', 'notprop' => 'count|list|index', 'notformat' => 'flyout', 'notlimit' => $limit, 'uselang' => $wt->uselang);
        foreach ($wikis as $wiki => $row) {
            $apiRequestArr[] = array("wiki" => $wiki, "apiUrl" => str_replace("http", "https", $row['url']) . "/w/api.php", "data" => $data);
        }
        #$perflog->stack[] = $wikis;
        $res = $wt->OAuthObject->doApiMultiQuery($apiRequestArr);
        #$perflog->stack[] = $res;
        $msgs = '';
        $countnew = 0;
        foreach ($res as $wiki => $rawrow) {
            if (isset($rawrow->error)) {
                $row = new stdClass();
                $row->index = array(0);
                $row->list->{'0'}->{'*'} = '<div class="mw-echo-state"><img class="mw-echo-icon" src="//bits.wikimedia.org/static-1.24wmf15/extensions/Echo/modules/icons/Generic.png"></img><div class="mw-echo-content">' . "Error: {$wiki} " . $rawrow->error->info . '</div></div>';
                $row->list->{'0'}->timestamp->mw = null;
                $error = true;
            } else {
                $row = $rawrow->query->notifications;
                $countnew += $row->count;
                $error = false;
            }
            foreach ($row->index as $idx) {
                $domain = $wt->metap[$wiki]["domain"];
                $msg = str_replace(array('/wiki/', '/w/'), array("//{$domain}/wiki/", "//{$domain}/w/"), $row->list->{$idx}->{"*"});
                $wi = $wt->getWikiInfo(null, null, $domain, false);
                $imglang = '<img height=12px alt="' . $wi->lang . '" src="' . $wi->imglang . '" />';
                $imgfam = '<img height=16px src="' . $wi->imgwiki . '" />';
                $msgArr[$wiki . $idx] = array("error" => $error, "wiki" => $wiki, "lang" => $wt->metap[$wiki]["lang"], "timestamp" => $row->list->{$idx}->timestamp->mw, "read" => @$row->list->{$idx}->read, "text" => $msgwrap1 . $msg . $imglang . '&nbsp;' . $imgfam . $msgwrap2);
            }
        }
        krsort($msgArr);
        $resArr = array('user' => $wikiArr["username"], 'attached' => $wikiArr["attached"], 'unattached' => $wikiArr["unattached"], 'countnew' => $countnew, 'msgArr' => $msgArr);
        $redis->setex($hash, $ttl, serialize($resArr));
        $perflog->add(__FUNCTION__, 0, 'numArr: ' . count($msgArr));
    } else {
        $resArr = unserialize($lc);
        $perflog->add(__FUNCTION__, 0, 'from Redis');
        #$perflog->add(__FUNCTION__, 0, $lc);
    }
    $countnew = $resArr["countnew"];
    $bgclass = $countnew ? " xt-badge-unread" : "";
    $list = '
			<div class="xt-badge' . $bgclass . '" >' . $countnew . '
			<div class="mw-echo-overlay" >
				<ul class="mw-echo-notifications" style="max-height: 570px;">
		';
    $configlink = $msgwrap1 . '<span style="display:block; text-align:center;" >' . str_replace('{$linktext}', ' Configure XAgent', $wt->statusLink['agentconfig']) . '</span>' . $msgwrap2;
    $showall = $msgwrap1 . '<span style="display:block; text-align:center;" >' . str_replace('XEcho', 'XEcho - Show all available notifications.', $wt->statusLink['echo']) . '</span>' . $msgwrap2;
    $listerr = '';
    if ($type == 'agent') {
        foreach ($resArr["msgArr"] as $time => $row) {
            if ($row["read"]) {
                continue;
            }
            if ($row["error"]) {
                $listerr .= $row["text"];
            } else {
                $list .= $row["text"];
            }
        }
        $list .= $listerr . $configlink . $showall . '</ul></div></div>';
        return $list;
    } else {
        $resArr["list"] = $list . '</ul></div></div>';
        return $resArr;
    }
}
Beispiel #4
0
#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">';
    foreach ($autowiki["topwikis"] as $wiki => $row) {
        $diff = $wt->datediff(new DateTime($row["latest"]));
        $diffsp = "<span style=\"color:{$diff->diffcolor} \" >{$diff->difftxt}</span>";
        $autowikilist .= '<tr><td>' . $wiki . '</td><td>' . $row["editcount"] . '</td><td>' . $wt->dateFmt($row["latest"]) . '</td><td>' . $diffsp . '</td></tr>';
    }
    $autowikilist .= '</table>';
}
// both configs are for JS-Hanlder in xagent.js
$defCfg = array('showAuthor' => "1", 'showCreatedby' => '1', 'showPageview' => '1', 'showRevision' => '1', 'showWatcher' => '1', 'showMainauthor' => 0, 'trackpages' => array("enwiki|Enterprise social graph", "Eva Green", "dewiki|Babylon 5"), 'trackwikis' => array("enwiki", "dewiki", "metawiki", "wikidatawiki", "commonswiki"), 'defaultWiki' => 'enwiki', 'status' => 'enabled', 'mode' => 'verbose', 'uselang' => 'default');
$clearCfg = new stdClass();
foreach ($defCfg as $prop => $val) {
    $clearCfg->{"{$prop}"} = null;
}
$wt->moreScript = "clearConfig = " . json_encode($clearCfg) . "\ndefaultConfig = " . json_encode($defCfg) . ";\nxsessionid='" . session_id() . "';\nsettingsLoad();";
Beispiel #5
0
        			$relWords = array();
        			foreach ($userWords as $k => $v) {
        				if ($mostUsedWords[$k] >= 10) // To avoid words you've used 1-9 times and no one else uses to dominate the list
        					$relWords[$k] = ($v / $numWordsUser) / ($mostUsedWords[$k] / $numWordsTotal);
        			}
        			asort($relWords);
        			$relWords = array_reverse($relWords);
        			printWordList($relWords, true);
        			$content[] = '<br>'.getString('relMostUsedEmoticonsFor').' '.$user['username'].':<br>';
        			$relEmoticons = array();
        			foreach ($userEmoticons as $k => $v) {
        				if ($mostUsedWords[$k] >= 10) // To avoid emoticons you've used 1-9 times and no one else uses to dominate the list
        					$relEmoticons[$k] = ($v / $numEmoticonsUser) / ($mostUsedEmoticons[$k] / $numEmoticonsTotal);
        			}
        			asort($relEmoticons);
        			$relEmoticons = array_reverse($relEmoticons);
        			printWordList($relEmoticons, true);
        		}*/
    }
}
echo mysqli_fetch_assoc(getQuery("SELECT stats FROM chat"))["stats"];
// This should probably be done in a thread or similar
$lastStats = mysqli_fetch_assoc(getQuery("SELECT stats_timestamp FROM chat"))["stats_timestamp"];
if (time() - 24 * 60 * 60 > $lastStats) {
    getNumbers();
    getUserActivity();
    getDailyActivity();
    $json = json_encode($stats, JSON_NUMERIC_CHECK);
    $time = time();
    setQuery("UPDATE chat SET stats = '{$json}', stats_timestamp = '{$time}'");
}