<?php
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'liveticker.php');
define("NO_ONLINE", 1); //Do not show in who-is-online-list
$templatelist = ""; //Do not need any extra templates
require_once "./global.php";
$last_action_written = "";
if(isset($_GET['last'])) $last = mysql_real_escape_string($_GET['last']);
else $last = 0;
$query = $db->query("SELECT * FROM `users_actions`
WHERE `users_actions`.`uid` != 0 AND
`users_actions`.`action_time` > $last AND
(`users_actions`.`action` LIKE '%thread-%.html%' OR
`users_actions`.`action` LIKE '/newreply.php%' OR
`users_actions`.`action` LIKE '/private.php%' OR
`users_actions`.`action` LIKE '/search.php%' OR
`users_actions`.`action` LIKE '/stats.php%' OR
`users_actions`.`action` LIKE '/irc.php%' OR
`users_actions`.`action` LIKE '/member.php?action=logout%' OR
`users_actions`.`action` LIKE '/member.php?action=login%'
)
ORDER BY `users_actions`.`action_time` DESC
LIMIT 0,50");
$done = false;
while($erg = $db->fetch_array($query))
{
$u = get_user($erg['uid']);
$p = $erg['action'];
$p = eregi_replace("[^ä]*forum-([0-9]+).html[^ä]*", "forumdisplay.php?fid=\\1", $p);
$p = eregi_replace("[^ä]*forum-([0-9]+)-page-([0-9]+).html[^ä]*", "forumdisplay.php?fid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+).html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+)-page-([0-9]+).html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+)-lastpost.html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+)-nextnewest.html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+)-nextoldest.html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+)-newpost.html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("[^ä]*thread-([0-9]+)-post-([0-9]+).html[^ä]*", "showthread.php?tid=\\1", $p);
$p = eregi_replace("post-([0-9]+).html", "showthread.php?pid=\\1", $p);
if(strpos($p,"showthread.php")!==false)
{
$pos = strpos($p,"tid=")+4;
$tid = substr($p,$pos);
$thread = get_thread($tid);
$thread_name = $thread['subject'];
$thread_link = get_thread_link($tid);
$loc = "liest das Thema <a href=\"$thread_link\" title=\"$thread_name\">$thread_name</a>.";
}
elseif(strpos($p,"newreply.php")!==false)
{
$pos = strpos($p,"tid=")+4;
$tid = substr($p,$pos);
$thread = get_thread($tid);
$thread_name = $thread['subject'];
$thread_link = get_thread_link($tid);
$loc = "schreibt eine Antwort im Thema <a href=\"$thread_link\" title=\"$thread_name\">$thread_name</a>.";
}
elseif(strpos($p,"member.php?action=logout")!==false)
{
$loc = "meldet sich ab. Schönen Tag noch.";
}
elseif(strpos($p,"member.php?action=login")!==false)
{
$loc = "meldet sich an. Hallo!";
}
elseif(strpos($p,"private.php")!==false)
{
$loc = "benutzt das <a href=\"/private.php\">PN-System</a>.";
}
elseif(strpos($p,"stats.php")!==false)
{
$loc = "sieht sich die <a href=\"/stats.php\">Statistiken</a> an.";
}
elseif(strpos($p,"search.php")!==false)
{
$loc = "<a href=\"/search.php\">durchsucht</a> das Forum.";
}
$username = build_profile_link(format_name($u['username'], $u['usergroup'], $u['displaygroup']), $erg->uid);
if (isset($loc) && $last_action_written != $loc && strpos($loc,' title=""></a>')===false)
{
if ($done==false) {
echo $username." ".$loc;
$done = true;
}
else
{
echo "<br>".$username." ".$loc;
}
$last_action_written = $loc;
}
}