Example #1
0
function showLatestTopics()
{
    require './variables.php';
    $forum_exclude = "(12, 15, 97)";
    //admin and mod forums
    $PREFIX = "phpbb3_";
    $TOPICS_TABLE = $PREFIX . "topics";
    $FORUMS_TABLE = $PREFIX . "forums";
    $POSTS_TABLE = $PREFIX . "posts";
    $USERS_TABLE = $PREFIX . "users";
    $forum_path = "/forum/";
    $topics = 10;
    $sql_topics = "SELECT topic from " . $topicstable . " where active ='Y' ORDER BY prio DESC";
    $result = mysql_query($sql_topics);
    $in_topics = "";
    $not_in_topics = "";
    $num = mysql_num_rows($result);
    $count = 0;
    $topicsExclude = "";
    $inline = "";
    if ($num > 0) {
        $inline = "";
        while ($row = mysql_fetch_array($result)) {
            $count++;
            $inline .= $row[0];
            if ($count < $num) {
                $inline .= ", ";
            }
        }
        $in_topics = " AND t.topic_id in (" . $inline . ") ";
        $sql_sticky = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id, t.topic_title, p.post_text, p.post_time, u.username \r\n      FROM phpbb3_topics t, phpbb3_posts p, phpbb3_users u, " . $topicstable . " tt\r\n      WHERE t.topic_approved='1' \r\n      AND tt.active='Y' \r\n      AND tt.topic=t.topic_id\r\n      AND t.forum_id NOT IN " . $forum_exclude . " \r\n      AND t.topic_last_post_id=p.post_id \r\n      AND p.poster_id = u.user_id " . "ORDER BY tt.prio DESC, t.topic_last_post_time DESC limit 0," . $topics;
        $result = mysql_query($sql_sticky);
        while ($row = mysql_fetch_array($result)) {
            $mar_title = $row["topic_title"];
            $mar_url = $forum_path . 'viewtopic.php?t=' . $row["topic_id"];
            $mar_user = $row["username"];
            $topic_link = '<a href="' . $mar_url . '">' . $mar_title . '</a>';
            $post_time = formatAgoSpan($row["post_time"]) . " ago";
            $topic_user = '******' . " (by <b>{$mar_user}</b>, {$post_time})" . '</span>';
            $line = $topic_link . $topic_user;
            $title = htmlentities(escapePostText($row["post_text"]));
            echo '<tr title="' . $title . '">';
            if ($row['prio'] >= 1000) {
                echo '<td class="link-stickytopic-hot" colspan="3">';
            } else {
                echo '<td class="link-stickytopic" colspan="3">';
            }
            echo $line;
            echo "</td>";
            echo "</tr>";
            $topics--;
        }
    }
    if (!empty($inline)) {
        $topicsExclude = "AND t.topic_id NOT IN (" . $inline . ") ";
    }
    $sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id, t.topic_title, p.post_text, p.post_time, u.username \r\n    FROM phpbb3_topics t, phpbb3_posts p, phpbb3_users u \r\n    WHERE t.topic_approved='1' \r\n    AND t.forum_id NOT IN " . $forum_exclude . " \r\n     " . $topicsExclude . "\r\n    AND t.topic_last_post_id=p.post_id \r\n    AND p.poster_id = u.user_id ORDER BY t.topic_last_post_time DESC limit 0," . $topics;
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
        $mar_title = $row["topic_title"];
        $mar_url = $forum_path . 'viewtopic.php?p=' . $row["topic_last_post_id"] . '#p' . $row["topic_last_post_id"];
        $mar_user = $row["username"];
        $topic_link = '<a href="' . $mar_url . '">' . $mar_title . '</a>';
        $post_time = formatAgoSpan($row["post_time"]) . " ago";
        $topic_user = '******' . " (by <b>{$mar_user}</b>, {$post_time})" . '</span>';
        $line = $topic_link . $topic_user;
        $title = htmlentities(escapePostText($row["post_text"]));
        echo '<tr title="' . $title . '">';
        echo '<td colspan="3">';
        echo $line;
        echo "</td>";
        echo "</tr>";
    }
}
Example #2
0
 }
 if ($draws != 1) {
     $s_draw = "s";
 }
 if ($wins > 0 || $losses > 0 || $draws > 0) {
     $msg = "You're currently ranked <b>{$positionPlayer}</b> on the {$ladder} ladder " . "with <b>{$points}</b> points, <b>{$wins}</b> win{$s_win}, <b>{$draws}</b> draw{$s_draw} and <b>{$losses}</b> defeat{$s_loss}";
 }
 $sql = "SELECT name, UNIX_TIMESTAMP(lastUpdated) AS lastUpdatedTS FROM weblm_donations order by lastUpdated desc limit 0,1";
 $result = mysql_query($sql);
 if (mysql_num_rows($result) > 0) {
     if (strlen($msg) > 0) {
         $msg .= "<br>";
     }
     $rowDonator = mysql_fetch_array($result);
     $donatorName = $rowDonator['name'];
     $donatedAgo = formatAgoSpan($rowDonator['lastUpdatedTS']);
     $sql = "SELECT player_id from weblm_players WHERE name='" . $donatorName . "'";
     $result = mysql_query($sql);
     if (mysql_num_rows($result) > 0) {
         $donatorName = '<a href="/profile.php?name=' . $rowDonator['name'] . '">' . $rowDonator['name'] . "</a>";
     } else {
         $donatorName = '<b>' . $rowDonator['name'] . "</b>";
     }
     $msg .= '<table align="center"><tr>' . '<td><img style="vertical-align:middle;" src="/gfx/awards/donator.gif" /></td>' . '<td class="darkgrey-small"><a href="/donate.php">Latest donation</a> by <b>' . $donatorName . '</b> (' . $donatedAgo . ' ago)</td>' . '</tr></table>';
 }
 $approved = $row['approved'];
 $nameClass = colorNameClass($cookie_name, $approved);
 if ($approved == 'no') {
     $inactive = true;
     $sql = "SELECT * FROM {$playerstatustable} WHERE type = 'B' and active = 'Y' and userName = '******'";
     $result = mysql_query($sql);
Example #3
0
	                             }
	                             if (($winnerresult == $loserresult) && !$drawOverride) {
		                             // check for double reports		                        
		                             $sql = "SELECT * FROM $gamestable ".
		                             "where ((winner = '$losername' or loser = '$losername' or winner2 = '$losername' or loser2 = '$losername') ".
		                             "AND (winner = '$winnername' or loser = '$winnername' or winner2 = '$winnername' or loser2 = '$winnername')) ".
		                             "and winnerresult = '$winnerresult' and loserresult = '$loserresult' ".
		                             "and ((winnerteam = '$winnerteamId' and loserteam = '$loserteamId') or (winnerteam = '$loserteamId' and loserteam = '$winnerteamId')) ". 
		                             "and dateday = '$dateday' ".
		                             "order by game_id desc limit 0,1";
		                           
		                              $result = mysql_query($sql);
			                             if (mysql_num_rows($result) > 0) {
				                             $row = mysql_fetch_array($result);
				                             $gameid = $row['game_id'];
			                             	 $timeago = formatAgoSpan($row['date']);
			                             	 $error.= "<p>A similar draw with the same teams was reported ".$timeago.' ago. Please check <b><a href="/games.php?gameId='.$gameid.
			                             	 	'" target="_blank">Game #'.$gameid.'</a></b> to check if your report is correct, then submit again.</p>';
			                             	 $drawOverride = true;
			                             }
			                             
	                             }
	                             
	                             if (empty($error)) {
		                             $replayname = '';
		                             if ($approvegames != "yes") { 
		                                 $rec = 'no';
		                                 $gameid = 'null';
		                                 $report = ReportGame($winnername, $winnername2, $losername, $losername2, $date, $comment, 
										 	$gameid, $winnerresult, $loserresult, $host, 
										 	$fairness, $version, $winnerteamId, $loserteamId, NULL);