Public feed #530215

devil

public php v1 · immutable
Raw Edit
·published 2007-06-02 01:59 UTC
rendered paste body
<?php/*** @version 0.8.9* @package Eventlist Modul* @copyright (C) 2005 Christoph Lukes* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL*/// no direct accessdefined( '_VALID_MOS' ) or die( 'Restricted access' );global $database, $my, $mainframe, $mosConfig_live_site;// added by Devil *start*// java-script and params if scroller set onif ($params->get('showscroller') == 1) 	{$height		=$params->get('height');$bgcolor	=$params->get('bgcolor');$border		=$params->get('border');$delay		=$params->get('delay');$speed		=$params->get('speed');$pause		=$params->get('pause');$width		=$params->get('width');$divs 		= "1"; ?><script type="text/javascript">/************************************************ Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)* This notice MUST stay intact for legal use* Visit http://www.dynamicdrive.com/ for this script and 100s more.***********************************************/var delayb4scroll=<?php echo $delay ?>000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)var marqueespeed=<?php echo $speed ?> //Specify marquee scroll speed (larger is faster 1-10)var pauseit=<?php echo $pause ?> //Pause marquee onMousever (0=no. 1=yes)?////NO NEED TO EDIT BELOW THIS LINE////////////var copyspeed=marqueespeedvar pausespeed=(pauseit==0)? copyspeed: 0var actualheight=''function scrollmarquee(){if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"elsecross_marquee.style.top=parseInt(marqueeheight)+8+"px"}function initializemarquee(){cross_marquee=document.getElementById("vmarquee")cross_marquee.style.top=0marqueeheight=document.getElementById("marqueecontainer").offsetHeightactualheight=cross_marquee.offsetHeightif (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exitcross_marquee.style.height=marqueeheight+"px"cross_marquee.style.overflow="scroll"return}setTimeout('lefttime=setInterval("scrollmarquee()",40)', delayb4scroll)}if (window.addEventListener)window.addEventListener("load", initializemarquee, false)else if (window.attachEvent)window.attachEvent("onload", initializemarquee)else if (document.getElementById)window.onload=initializemarquee</script><?php// added by Devil *end*//delete events older than x daysif ($params->get('oldDeletemod', '0') == 1) {	$delevents = 'DELETE FROM #__eventlist_dates WHERE DATE_SUB(NOW(), INTERVAL '.(int)$params->get( 'minus','2' ).' DAY) > dates';	$database->setQuery($delevents);	$database->query();}//archive events older than x daysif ($params->get('oldDeletemod', '0') == 2) {	$archevents = 'UPDATE #__eventlist_dates SET published= -1 WHERE DATE_SUB(NOW(), INTERVAL '.(int)$params->get( 'minus','2' ).' DAY) > dates';	$database->setQuery($archevents);	$database->query();}//getItemid$itemidquery = 'SELECT id FROM #__menu WHERE link = "index.php?option=com_eventlist" AND published > 0';$database->setQuery($itemidquery);$Itemid = $database->loadResult();if ($params->get( 'type', '0' ) == 0) {	$where = ' WHERE a.published = 1';	$order = ' ORDER BY a.dates, a.times';} else {	$where = ' WHERE a.published = -1';	$order = ' ORDER BY a.dates DESC, a.times DESC';}//get $params->get( 'count', '2' ) nr of datasets$query = 'SELECT a.*, l.club, l.city, l.url'		.' FROM #__eventlist_dates AS a'		.' LEFT JOIN #__eventlist_locate AS l ON l.id = a.locid'		.' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid'		. $where		.' AND c.access <= '.(int)$my->gid		. $order		.' LIMIT '.(int)$params->get( 'count', '2' )		;$database->setQuery($query);$rows = $database->loadObjectList();//Two linesfunction elmod_two_lines($rows, $Itemid, &$params){	?>	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="moduletable<?php echo $params->get('moduleclass_sfx'); ?>">	<?php	$k = 0;	for($i=0; $i < count( $rows ); $i++) {	$row = $rows[$i];	//format date	$datum = strftime($params->get('formatdate', '%d.%m.%Y'), strtotime( $row->dates ));	$zeit = strftime( $params->get('formattime', '%H:%M'), strtotime( $row->times ));	?>		<tr>    		<td align="<?php echo $params->get('align', 'left'); ?>">    			<?php				if ($params->get('linkdet', '1') == 1) {					echo "<a href='".sefRelToAbs("index.php?option=com_eventlist&Itemid=$Itemid&func=details&did=$row->id")."'>$datum |</a> ".$zeit."";				} else {					echo $datum." | ".$zeit ;				}				?>			</td>		</tr>		<tr>			<td align="<?php echo $params->get('align', 'left'); ?>">    			<?php				if ($params->get('showtitloc', '0') == 0) {					if ($row->url && $params->get('linkloc', '1') == 1) {						?>						<a href="<?php echo format_url($row->url); ?>" target="_blank"><?php echo $row->club; ?></a>						<?php					} else {						echo $row->club;					}				} else {					//cut titel					$beschnitten = strlen($row->titel);					if ($beschnitten > $params->get('cuttitle', '18')) {						$row->titel = substr($row->titel, 0, $params->get('cuttitle', '18'));						$row->titel = $row->titel.'...';					}					if ($params->get('linkdet', '1') == 2) {						echo "<a href='".sefRelToAbs('index.php?option=com_eventlist&Itemid='.$Itemid.'&func=details&did='.$row->id)."'>$row->titel</a>";					} else {						echo $row->titel;					}				}				?>			</td>  		</tr>  		<?php $k = 1 - $k; } ?>  	</table>  </div></div><?php}//One linefunction elmod_one_line($rows, $Itemid, &$params){	?>	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="moduletable<?php echo $params->get('moduleclass_sfx'); ?>">	<?php   	$k = 0;	for($i=0; $i < count( $rows ); $i++) {	$row = $rows[$i];	//format date	$datum = strftime( $params->get('formatdate', '%d.%m.%Y'), strtotime( $row->dates ));	?>   		<tr>			<td align="<?php echo $params->get('align', 'left'); ?>">    			<?php				if ($params->get('linkdet', '1') == 1) {					echo "<a href='".sefRelToAbs('index.php?option=com_eventlist&Itemid='.$Itemid.'&func=details&did='.$row->id)."'>$datum</a>";				} else {					echo $datum;				}				?>	 			/				<?php				if ($row->url && $params->get('linkloc', '1') == 1){					?>					<a href="<?php echo format_url($row->url); ?>" target="_blank"><?php echo $row->club; ?></a>					<?php				} else {					echo $row->club;				}				?>			</td>		</tr>  		<?php $k = 1 - $k; } ?>	</table></div></div><?php}function format_url($url){	if(strtolower(substr($url, 0, 7)) == 'http://') {		$url = $url;	} else {		$url= 'http://'.$row->url;	}	return $url;}//any events to display?if (empty($rows)) {?>	<table class="moduletable<?php echo $params->get('moduleclass_sfx'); ?>">		<tr>			<td><?php echo $params->get('noevents', 'Sorry, no events to display'); ?></td>		</tr>	</table><?php} else { 	if ($divs==1){  echo "<div id='marqueecontainer' onMouseover='copyspeed=pausespeed' onMouseout='copyspeed=marqueespeed' style='position: relative; width: $width; height:$height; background-color:$bgcolor; overflow: hidden; border:$border;padding: 2px; padding-left: 4px;'>";  echo "<div id='vmarquee' style='position: absolute; width: 98%;' >";                }	 if ($params->get('view', '1') == 1) 	{ 		elmod_two_lines($rows, $Itemid, $params);		   } else { 	    elmod_one_line($rows, $Itemid, $params);					} 					if ($divs==1){				echo"</div></div>";	}?>