<?php
/**
 * pragmaMx  Content Management System
 * Copyright (c) 2006 pragmaMx Dev Team - http://pragmaMx.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, or
 * (at your option) any later version.
 * 
 * $Source: /home/www/dps3311/home/cvsroot/pragmamx/html/blocks/block-Last_5_Articles.php,v $
 * $Revision: 1.3.4.1 $
 * $Author: tora60 $
 * $Date: 2006/09/23 00:05:17 $
 * 
 * enahnced with scrolling by cn.fSZ DevTeam and Akcaabat-Acisu.Com, http;//www.cnfsz.eu/, http://www.akcaabat-acisu.com/
 * $Date: 2007/04/21 12:12:12 $
 * 
 * this file based on:
 * php-nuke Web Portal System - http://phpnuke.org/
 * Thatware - http://thatware.org/
 */
$thisfile = basename(__file__);
if (!defined("mxMainFileLoaded")) die ("You can't access this file directly...");

$mxblockcache = false;
$scrollheight = '100';
global $prefix;

if ($GLOBALS["multilingual"] == 1) {
    if (ereg("german", $GLOBALS["currentlang"])) $thislang = "german";
    else $thislang = $GLOBALS["currentlang"];
    $querylang = " WHERE (alanguage LIKE '$thislang%' OR alanguage='') AND topic=20 AND `time` <= now()";
} else {
    $querylang = "WHERE topic=20 AND `time` <= now()";
} 
$result = sql_query("select sid, title from ${prefix}_stories $querylang ORDER BY `time` DESC limit 0,5");
$output = '';
$sid = '';
while ($row = sql_fetch_array($result)) {
	if (empty($row['title'])) {
		if (preg_match('#^(.+)\.[^.]{2,4}$#', $row['filename'], $matches)) {
			$row['title'] = $matches[1];
		}
		$row['title'] = str_replace('_', ' ', $row['title']);
	}
    $output .= '<div align="left" valign="baseline"><strong><big>&middot;</big></strong>&nbsp;<a href="modules.php?name=News&amp;file=article&amp;sid='.$row['sid'].'">'.$row['title'].'</a><br><br></div>';
    $sid++;
} 

if ($output) {
    $content = '<div align="center">
	<marquee loop="0" behavior="SCROLL" direction="up" width="90%" scrollamount="1" height="'.$scrollheight.'" scrolldelay="1" onmouseover="this.stop()" onmouseout="this.start()">
  ' . $output . '
	</marquee>
	</div>
	<p align="center"><span class="tiny">[&nbsp;<a href="modules.php?name=News&new_topic=20">' . _MORENEWS . '</a>&nbsp;]</span></p>';
}

?>
