Code:<?php
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
##########################################################################
# #
# Mozaks-News 0.3 BY MOZAKS #
# (www.mozaks.com) #
# #
# Support Forum : www.sempoi.net/forum #
# #
# Enhanced by theDailyRant.net #
# #
# (www.thedailyrant.net) #
# #
##########################################################################
/* Config START */
$limit = 5; // display how many articles per topic
$column = 1; // number of columns to display - default = 1
$textlength = 34; // your news title length - if the title is longer than this value,
// it will be cut and the full name will be listed in the mouse hover
/* Config END */
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
// Function to cut long text
function cut($str,$max){
$count = strlen($str);
if($count >= $max) {
for ($pos=$max;$pos>0 && ord($str[$pos-1])>=127;$pos--);
if (($max-$pos)%2 == 0)
$str = substr($str, 0, $max) . "...";
else
$str = substr($str, 0, $max+1) . "...";
return $str;
} else {
$str = "$str";
return $str;
}
}
function index(){
global $limit, $column, $dbi, $textlength;
include("header.php");
$copy = "<A HREF=\"http://www.mozaks.com\" target=\"_blank\"><font class=tiny>Powered by Mozaks News 0.3</font></A><br>
<A HREF=\"http://www.thedailyrant.net\" target=\"_blank\"><font class=tiny>Enhanced by theDailyRant.net</font></A>";
$result1 = sql_query("SELECT topicid, topicname, topictext, topicimage FROM ".$prefix."_topics where displayhome='1' ORDER BY displayorder", $dbi);
$x = 1;
echo "\n<!-- START MOZAKS NEWS 0.3 -->\n"
."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" align=\"center\">";
while (list($topicid, $topicname, $topictext, $topicimage) = sql_fetch_row($result1, $dbi)) {
$cnt = sql_num_rows(sql_query("SELECT sid FROM ".$prefix."_stories where topic=$topicid", $dbi), $dbi);
if ( $cnt > 0 ){
if( $x>$column ) { $x=1; }
if( $x==1 ) { echo "<TR>"; }
else { echo "<td> </td>"; }
echo "<td align=center valign=top>";
OpenTableHome();
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" align=\"center\">\n"
."<tr>\n"
."<td>"
// Display the topics image - comment out the line below to remove the image
//."<img src=\"images/topics/".$topicimage."\">"
// Display the topics title - comment out the line below to remove the title
."<strong>$topictext</strong>"
// Link to view more stories of the topic
."</td><td valign=\"bottom\" align=right> <a href=\"modules.php?name=News&new_topic=".$topicid."\">more..</a> </td>\n"
."</tr>\n"
."</table>\n";
// Bold line below topic title
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">\n"
."<tr>\n"
// Topic line's color - you could change the colour code to suit your theme
."<td height=0 bgcolor=\"#cccccc\"><img src=modules/Mozaks_News/img/pixel.gif width=1 height=1></td>\n"
."</tr>\n"
."</table>\n";
$result = sql_query("SELECT sid, catid, aid, title, time, comments, counter, topic, informant, score, ratings FROM ".$prefix."_stories where topic=$topicid ORDER BY sid DESC limit 0,$limit", $dbi);
while (list($s_sid, $catid, $aid, $title, $time, $comments, $counter, $topic, $informant, $acomm, $score, $ratings) = sql_fetch_row($result, $dbi)) {
$Y = substr($time, 2, 2);
$M = substr($time, 5, 2);
$D = substr($time, 8, 2);
// Date (D=day, M=month, Y=year) - can be changed to other format such as $M.".".$D.",".$Y;
$time = $D."/".$M."/".$Y;
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
."<tr><td>\n"
."<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">\n"
// Change the colour here to match your theme
."<tr height=\"20\" onmouseover=\"this.style.backgroundColor='#F9F9F9'\" onmouseout=\"this.style.backgroundColor=''\">\n"
// News titles begins from here
."<td align=\"left\"> "
// Comment / uncomment one of the lines below to display a choice of news image
// !!! it is recommended to use the directory structure below and number the images by the story id !!!
// Display an image related to the news story - uncomment out the line below to show an image
//."<img src=\"images/news/".$s_sid.".gif\">"
// Display a bold dot before the news title
."<strong><big>·</big></strong>"
// the link, mouse over and text of the news title
." <a href=\"modules.php?name=News&file=article&sid=$s_sid$r_options\" title='".$title."'>"
.cut($title,$textlength)
."</a></td>\n"
."<td align=\"right\">["
// Here you can add more info of the news item by commenting and uncommenting the following lines
."$counter reads | "
."$comments comments |"
//."Informant: $informant | "
//."Score: $score | "
."$time"
."] </td>\n"
."</tr></table></td></tr></table>\n"
// Bold line below topic title
."<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">\n"
."<tr>\n"
// Topic line's color. You could change the color code to suit your theme
."<td height=0 bgcolor=\"#cccccc\"><img src=modules/Mozaks_News/img/pixel.gif width=1 height=1></td>\n"
."</tr>\n"
."</table>\n";
}
echo "</td>";
CloseTableHome();
if($x==$column) { echo "</TR><tr><td> </td></tr>"; }
$x++;
}
}
$col = $column+1;
echo "<tr><td align=right colspan=".$col.">".$copy."</td></tr></table>"
."\n<!-- END MOZAKS NEWS 0.3 -->\n";
include("footer.php");
}
switch ($op) {
default:
index();
break;
}
?>
|