Jump to content
GIGN Forum

Ipb News


DST
 Share

Recommended Posts

http://www.google.lv/search?q=ipb+mod+news...lient=firefox-a

<?php
/*********************************************/
/* IPB News System                           */
/* Copyright 2006 - 2007                     */
/* NuclearGeneral - Tiberium Studios         */
/* http://www.tiberiumstudios.net/?id=portal */
/* New Features:                             */
/* - Smileys                                 */
/* - IPB BBCodes Support                     */
/* - Latest Post Displayed on                */
/*   Top                                     */
/* - New Design for Posts                    */
/* - Starts 1 - Unlimited                    */
/*********************************************/
/*         Copyright Notice Below!!!         */
/*********************************************/
/* DO NOT REMOVE ANY COPYRIGHT NOTICES!!!    */
/* DO NOT REMOVE ANY COPYRIGHT NOTICES!!!    */
/* DO NOT REMOVE ANY COPYRIGHT NOTICES!!!    */
/* DO NOT REMOVE ANY COPYRIGHT NOTICES!!!    */
/* DO NOT REMOVE ANY COPYRIGHT NOTICES!!!    */
/* DO NOT REMOVE ANY COPYRIGHT NOTICES!!!    */
/*                                           */
/* I Hope You See That!!!!!                  */
/* If you want to remove the copyright,      */
/* You must purchase copyright removal.      */
/* Copyright Removal Is A Fee Of $10 USD     */
/*********************************************/

############################
### SCRIPT CONFIGURATION ###
############################
//Server Path to The Forum
$cfg['forum_path']  = "/home/f";
//Which Forum to Read from (You can have multiple of these)
$cfg['forums_id'][] = "3";
//$cfg['forums_id'][] = "8";
//Position of the Newest Post (DESC = Top, ASC = Bottom)
$cfg['latest_pos']  = "DESC";
//Display News per Page
$cfg['per_page']    = "20";
//News Limit - Global Limit (0 - No Limit)
$cfg['news_limit']  = "3";
//Message to Display when there are no News
$cfg['no_news']     = "There is currently no news.";
//Show page selector (true, false)
$cfg['page_select'] = "true";
//DEBUG MODE -- MAKE SURE YOU KNOW WHAT YOU ARE DOING
$cfg['debug']       = "false";

##############
### SCRIPT ###
##############
require_once( $cfg['forum_path'] . "/conf_global.php" );

$mysql = mysql_connect( $INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass'] /*, $INFO['sql_driver'] */ );
if ( !$mysql ) {
    die( "<b>mysql_connect()</b>: ". mysql_error() );
}

$select_db = mysql_select_db( $INFO['sql_database'], $mysql );
if ( !$select_db ) {
    die( "<b>mysql_select_db()</b>: ". mysql_error() );
}

for ($i = 0; $i < count( $cfg['forums_id'] ); $i++ ) {
    $cfg['forum_id'] = $cfg['forums_id'][$i];

    if ( $cfg['news_limit'] != "0" ) {
        $query = mysql_query( "SELECT t.tid, t.title, t.topic_firstpost, p.pid, p.topic_id, p.post_date, p.author_id, m.id, m.name, p.post, t.posts
                               FROM ". $INFO['sql_tbl_prefix'] ."topics t, ". $INFO['sql_tbl_prefix'] ."posts p, ". $INFO['sql_tbl_prefix'] ."members m
                               WHERE t.forum_id = '". $cfg['forum_id'] ."'
                                   AND t.tid = p.topic_id
                                   AND p.author_id = m.id
                                   AND p.pid = t.topic_firstpost
                               ORDER BY p.post_date ". $cfg['latest_pos'] ."
                               LIMIT ". $cfg['news_limit'] );
    } else {
        $query = mysql_query( "SELECT t.tid, t.title, t.topic_firstpost, p.pid, p.topic_id, p.post_date, p.author_id, m.id, m.name, p.post, t.posts
                               FROM ". $INFO['sql_tbl_prefix'] ."topics t, ". $INFO['sql_tbl_prefix'] ."posts p, ". $INFO['sql_tbl_prefix'] ."members m
                               WHERE t.forum_id = '". $cfg['forum_id'] ."'
                                   AND t.tid = p.topic_id
                                   AND p.author_id = m.id
                                   AND p.pid = t.topic_firstpost
                               ORDER BY p.post_date ". $cfg['latest_pos'] );
    }

    if ( !$query ) {
        die( "<b>mysql_query()</b>: ". mysql_error() );
    }

    $iNews    = mysql_num_rows( $query );
    $iRun     = 0;
    $iCurrent = 0;

    if ( $iNews == 0 ) {
        echo "<span style=\"font-family: Tahoma; font-size: 13px\">". $cfg['no_news'] ."</span>";
    }

    while ( $row = mysql_fetch_array( $query, MYSQL_NUM ) ) {
        if ( $cfg['debug'] == "true" ) {
            print_r( $row );
        }

        $iRun++;
        if ( $iRun > ( $_GET['pg'] - 1 ) * $cfg['per_page'] && $iCurrent < $cfg['per_page'] ) {

    /* EDIT THE DISPLAY DESIGN BELOW - CAREFUL (BEGIN) */
$sTemplate = <<<EOT
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
  <tr>
  <th class="thTop" height="25"><A NAME="<!-- TOPIC -->" title="<!-- TITLE -->"><FONT class="topic_title"><!-- TITLE --></FONT></a></th><br />
  </tr>
  <tr>
    <td class="row1" align="center" width="100%">
      <span class="gensmall">
<hr size="1" width="100%"><br />
      <div align="left"><!-- POST --></div>
      </span>
<br />
      <span class="gensmall">
<div align="right">
Pievienojis : <a href="/f/index.php?showuser=<!-- USER -->" target="_blank" title="Click Here For <!-- AUTHOR -->'s Profile!"><B><!-- AUTHOR --></B></a> | [Komentāri <!-- REPLIES --> <img src=/comments.gif>] <a href="/f/index.php?showtopic=<!-- TOPIC -->" title="View This Topic" target="_blank">» Lasīt tālāk «</a>
</div>

      </span>
    </td>
  </tr>
</table>
<BR />
EOT;

    /* EDIT THE DISPLAY DESIGN BELOW - CAREFUL (END) */

            $sParsed = str_replace( array( "<!-- TITLE -->",
                                           "<!-- POST -->",
                                           "<!-- TIME -->",
                                           "<!-- AUTHOR -->",
                                           "<!-- REPLIES -->",
                                           "<!-- FORUM -->",
                                           "<!-- TOPIC -->",
                                           "style_emoticons/<#EMO_DIR#>", //SMILEY FIX
                                           "<!-- USER -->",
                                           "[indent]",
                                           "[/indent]",
                                           "class='quotetop'",
                                           "class='quotemain'",
                                           "class='codetop'",
                                           "class='codemain'" ),
                                    array( $row[1],
                                           $row[9],
                                           //Begin NuclearGeneral Custom Date
                                           date( "l, F j, Y h:i A", $row[5] ),
                                           //End NuclearGeneral Custom Date
                                           //Begin Orginal Date
                                           //date( "F m, Y", $row[5] ),
                                           //End Orginal Date
                                           $row[8],
                                           $row[10],
                                           $cfg['forum_path'],
                                           $row[0],
                                           $cfg['forum_path'] ."/style_emoticons/default",
                                           $row[7],
                                           "<blockquote>",
                                           "</blockquote>",
                                           "style='background: #E4EAF2; border: 1px dotted #000; border-bottom: 0; border-left: 4px solid #8394B2; color: #000; font-weight: bold; font-size: 10px; margin: 8px auto 0 auto; padding: 3px;'",
                                           "style='background: #FAFCFE; border: 1px dotted #000; border-left: 4px solid #8394B2; border-top: 0; color: #465584; padding: 4px; margin: 0 auto 8px auto;'",
                                           "style='background: #FDDBCC; color: #000; font-weight: bold; margin: 0 auto 0 auto; padding: 3px; width: 98%;'",
                                           "style='background: #FAFCFE; border: 1px dotted #000; color: #465584; font-family: Courier, Courier New, Verdana, Arial; margin: 0 auto 0 auto; padding: 2px; width: 98%;'" ),
                                    $sTemplate );

            if ( $cfg['debug'] != "true" ) {
                echo $sParsed;
            }

            $iCurrent++;
         }
    }

    mysql_free_result( $query );
}

mysql_close( $mysql );

if ( $cfg['page_select'] == "true" ) {
    if ( $_GET['pg'] == "1" || $_GET['pg'] == "" ) {
        echo "<span style=\"font-family: Tahoma; font-size: 13px\"><center><b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=1\"><<</a></b>";
    } else {
        echo "<span style=\"font-family: Tahoma; font-size: 13px\"><center><b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] - 1 ) ."\"><<</a></b>";
    }

    for ( $i = 0; $i < $iNews / $cfg['per_page']; $i++ ) {
        if ( $i == $_GET['pg'] - 1 || ( $i == 0 && $_GET['pg'] == "" ) ) {
            echo " <u>". ( $i + 1 ) ."</u> ";
        } else {
            echo " <a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $i + 1 ) ."\">". ( $i + 1 ) ."</a> ";
        }
    }

    if ( $_GET['pg'] == $i ) {
        echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". $_GET['pg'] ."\">>></a></b>";
    } else if ( $i > 1 && $_GET['pg'] == "" ) {
        echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] + 2 ) ."\">>></a></b>";
    } else if ( $i <= 1 && $_GET['pg'] == "" ) {
        echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] + 1 ) ."\">>></a></b>";
    } else {
        echo "<b><a style=\"text-decoration: none\" href=\"". $_SERVER['PHP_SELF'] ."?pg=". ( $_GET['pg'] + 1 ) ."\">>></a></b>";
    }
}
echo "<DIV align=\"center\" class=\"copyright\"></DIV>";
?>

Edited by NeoX
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...