Mediawiki Invision Power Board last post

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search
Blue Glass Arrow.svg MediaWiki logo.png
This page should be moved to MediaWiki.org.
Please do not move the page by hand. It will be imported by a MediaWiki.org administrator with the full edit history. In the meantime, you may continue to edit the page as normal.

This is the wiki page about Mediawiki Invision Power Board random photo, an extension of Mediawiki. This extension can be downloaded from its home page and contains authoritative information about the project.

License: GNU GPL

Description: Shows in table last post from Invision Power Board

Comments:

  • Need some cleaning (almost raw from dpLastPost),
  • Set your coding at the end of te code (return function).

[edit] Source code

<?php
# BASED on runphp Mediawiki Extension http://meta.wikimedia.org/wiki/Runphp
# BASED on dpLastPost from PostNuke
# To use extension type at your wiki: <forum></forum>

# To activate the extension, include it from your LocalSettings.php
# with: include("extensions/invision_last.php");

# Przemyslaw Stanislaw Knycz
# JID: djrzulf@kol.net.pl
# Written for http://czechowice.net/

$wgExtensionFunctions[] = "wfRunInvisionLast";

function wfRunInvisionLast() {
    global $wgParser;
    $wgParser->setHook( "forum", "IL" );
}


function IL() {
        $numMens = 5;
        $numCarThread = 30;
        $colSeparador = '#CCCCCC';
        $Mensajeria = 2;
        $ipb_path = "http://forum.somewhere.at.net/index.php";
        $ipb_table_prefix = "ibf";
        $ipb_dbhost = "localhost";
        $ipb_dbuser = "forumuser";
        $ipb_dbpass = "forumpass";
        $ipb_dbname = "forumdata";
        $tdbgcolor = "#F1F1F1";

        $content = '';
        $noshow = ""; // Don't show posts from these forums - seperate IDs with commas, eg: "2,8"

        $db_link = mysql_connect($ipb_dbhost, $ipb_dbuser, $ipb_dbpass);
        $sql = "SELECT DISTINCT tid, title, posts, views, last_poster_name, last_poster_id, forum_id, last_post FROM "
                . $ipb_table_prefix."_topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT "
                . $numMens;
        mysql_select_db( $ipb_dbname, $db_link );
        $result = mysql_db_query($ipb_dbname, $sql, $db_link);

        $content .= "<!-- Bloque dp-LastPostInvision creado por el_cuervo - dpSoft para dev-postnuke.com -->";
        $content .= '<table align="center" width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="#F1F1F1">';
        $content .= '<tr>';
                $content .= '<td>';
                        $content .= '<table align="center" width="100%" cellpadding="1" cellspacing="0" border="0">';
                        $content .= '<tr>';
                                $content .= '<td bgcolor="'.$tdbgcolor.'" align="left" valign="top"><span class="pn-title"><strong>'.Ostatnie.' '.na.' '.forum.'</strong></span></td>';
                                $content .= '<td bgcolor="'.$tdbgcolor.'" align="left" valign="top"><span class="pn-title"><strong>'.Autor.'</strong></span></td>';
                                $content .= '<td bgcolor="'.$tdbgcolor.'" align="center" valign="top"><span class="pn-title"><strong>  '.Wyświetleń.'  </strong></span></td>';
                        $content .= '<td bgcolor="'.$tdbgcolor.'" align="center" valign="top"><span class="pn-title"><strong>'.Odpowiedzi.'</strong></span></td>';
                                $content .= '<td bgcolor="'.$tdbgcolor.'" align="center" valign="top"><span class="pn-title"><strong>'.Aktualizacja.'</strong></span></td>';
                        $content .= '</tr>';
        while( $rows = mysql_fetch_object($result))
        {
                $tituloHilo = $rows->title;
                $autor = $rows->last_poster_name;
                $tituloHiloCorto = $tituloHilo;
                $autorCorto = $autor;

                $tid = $rows->tid;
                $replies = $rows->posts;

                $last_poster_id = $rows->last_poster_id;
                $forum_id = $rows->forum_id;
                $last_post = $rows->last_post;
                $views = $rows->views;

                if(strlen($tituloHiloCorto ) > $numCarThread)
        {
                        $tituloHiloCorto = strip_tags($tituloHiloCorto, '<a><i><b><ul><li>');
                $tituloHiloCorto = substr($tituloHiloCorto, 0, $numCarThread) . "...";
        }
                $content .= '<tr>';
                        $link = $ipb_path."?act=ST&f=".$forum_id."&t=".$tid."&view=getnewpost";
                $content .= '<td align="left"><a title="'.$tituloHilo.'" target="_BLANK" href="'.$link.'">'.$tituloHiloCorto.'</a></td>';
                        if( $Mensajeria == 2 ) { // enviar mensaje postnuke
                        $content .= '<td align="left">'.$autorCorto.'</a></td>';                        #} else if( $Mensajeria == 3 ) { // info de usuario
                        #$content .= '<td align="left"><a target="_BLANK" href="user.php?op=userinfo&uname='.$autor.'" title="'._DPLPI_USERINFO.' '.$autor.'">'.$autorCorto.'</a></td>';
                        } else { // nada
                        $content .= '<td align="left">'.$autorCorto.'</td>';
                        }
                        if ($views == 0) {
                $content .= '<td align="center"><font class="pn-sub">-</font></td>';
                        } else {
                $content .= '<td align="center"><font class="pn-sub">('.$views.')</font></td>';
                        }
                        if ($replies == 0) {
                $content .= '<td align="center"><font class="pn-sub">-</font></td>';
                        } else {
                $content .= '<td align="center"><font class="pn-sub">('.$replies.')</font></td>';
                        }
                        $fecha = date('H:i', $last_post+0*3600);
                        $content .= '<td align="center">' . $fecha . '</td>';
                $content .= '</tr>';
                $content .= '<tr>';
                        $content .= '<td height="1" bgcolor="'.$colSeparador.'"></td>';
                        $content .= '<td height="1" bgcolor="'.$colSeparador.'"></td>';
                        $content .= '<td height="1" bgcolor="'.$colSeparador.'"></td>';
                        $content .= '<td height="1" bgcolor="'.$colSeparador.'"></td>';
                        $content .= '<td height="1" bgcolor="'.$colSeparador.'"></td>';
                $content .= '</tr>';
        }
                        $content .= '</table>';
                $content .= '</td>';
        $content .= '</tr>';
        $content .= '</table>';
        #       $content .= '<br><center><a target="_BLANK" href="'.$ipb_path.'"><b>'._DPLPI_ENTRAR.'</b></a></center><br>';

        mysql_close($db_link);
        if (empty($row['title'])) {
                $row['title'] = "LastPostInvision";
        }
        return mb_convert_encoding($content,'UTF-8', 'ISO-8859-2');
}



?>


[edit] Page

http://www.czechowice.net/wiki/Mediawiki_Invision_Power_Board_last_post