<?php // $Id: theme.php,v 1.1.1.1 2003/08/25 22:23:25 EllselAn Exp $
/**********************************************************************/
/* vkpMx 2.0  Content Management System                               */
/* ================================================================== */
/* Copyright (C) 2003 by the vkpMx & pragmaMx Developer Team          */
/* email:         team@pragmamx.org                                   */
/* homepage:      http://www.maax-design.de                           */
/* further sites: http://www.pragmaMx.org, http://www.guggemahier.de, */
/*            http://www.marx-city.de, http://www.genutec-studios.de, */
/*            http://www.shiba-design.de, http://www.power-maax.de    */
/* ================================================================== */

global $thename;
$thename = basename(dirname(__FILE__));
global $VKPTheme; $VKPTheme = TRUE;
$GLOBALS['index'] = (empty($GLOBALS['index'])) ? 0 : 1;

# includen der settings.php mit den Angaben zu Farbe und Co. des Themas
include("themes/$thename/settings.php");

function OpenTable() {
    global $bgcolor1, $thename, $tmcol;
echo "<table width='100%' border='0' cellspacing='0' cellpadding='5'>"
	."<tr>"
	."<td>"
	."<table width='".$tmcol[0]."' border='0' cellspacing='0' cellpadding='0'>"
	."<tr>"
	."<td width='".$tmcol[0]."' align='center' valign='middle'>"
	."<img src='themes/$thename/images/cellpic3.gif' width='".$tmcol[0]."' height='21' border='0'>"
	."</td>"
	."</tr>"
	."</table>"
	."<table width='".$tmcol[0]."' border='0' cellspacing='0' cellpadding='1'>"
	."<tr>"
	."<td bgcolor='$bgcolor1'>"
	."<table width='".$tmcol[0]."' border='0' cellspacing='0' cellpadding='0'>"
	."<tr>"
	."<td bgcolor='$bgcolor1'>"
	."<table width='".$tmcol[0]."' border='0' cellspacing='0' cellpadding='4'>"
	."<tr>"
	."<td>";
}

function CloseTable() {
echo "</td>"
	."</tr>"
	."</table>"
	."</td>"
	."</tr>"
	."</table>"
	."</td>"
	."</tr>"          
	."</table>"
	."</td>"
	."</tr>"
	."</table>";
}
function OpenTable2() {
    global $bgcolor1, $bgcolor2, $thename, $tmcol;
    echo "<table width='70%' border='0' cellspacing='1' cellpadding='1' align='center'><tr><td background='themes/$thename/images/backtable.jpg'>\n"; #
    echo "<table width='100%' border='0' cellspacing='8' cellpadding='0' bgcolor='$bgcolor1'><tr><td>\n";
}

function CloseTable2() {
    echo "</td></tr></table></td></tr></table>\n";
}

function OpenTableAl() {
    global $bgcolor1, $thename, $tmcol;
    echo "<table width='85%' border='0' cellspacing='1' cellpadding='1' align='center'><tr><td bgcolor='#C4060B'>\n"; #
    echo "<table width='100%' border='0' cellspacing='8' cellpadding='0' bgcolor='$bgcolor1'><tr><td align='center'>\n";
}

function CloseTableAl() {
    echo "</td></tr></table>\n</td></tr></table>\n";
}

function FormatStory($thetext, $notes, $aid, $informant) {
	$notes = (empty($notes)) ? "" : "<br><br><b>"._NOTE."</b> <i>".$notes."</i>\n";
	if ($aid == $informant) {
		echo "<font class='content' color='#505050'>".$thetext." ".$notes."</font>\n";
		}
	else {
		$boxstuff = (empty($informant)) ? "" : "<i><a href='modules.php?name=Userinfo&amp;uname=".$informant."'>".$informant."</a> "._WRITES.":</i><br><br>";
		$boxstuff .= "".$thetext." ".$notes."\n";
		echo "<font class='content' color='#505050'>".$boxstuff."</font>\n";
		}
	}

/************************************************************/
/* Function themeheader()                                   */
/************************************************************/

function themeheader() {
	global $banners, $thename, $tmcol, $tmrow, $bgcolor1, $bgcolor2;

    echo "<body background='themes/$thename/images/bgft.jpg' text='#000000' link='#363636' vlink='#363636' alink='#d5ae83' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>\n";


	
echo "<table class='bodyline' width='".$tmcol[0]."' cellspacing='0' cellpadding='0' border='0'>"
	."<tr>"
	."<td align='center' valign='top'>"
	."<table class='topbkg' height='80' width='".$tmcol[0]."' cellspacing='0' cellpadding='0' border='0'>"
	."<tr>"
	."<td align='center' width='30%'><img src='themes/$thename/images/saxoblu.gif'></td>"
	."<td align='center' width='40%'><img src='themes/$thename/images/logo.gif'></td>"
	."<td align='center' width='30%'><img src='themes/$thename/images/106blu.gif'></td>"
    ."</tr>"
    ."</table>"
	."<table width='".$tmcol[0]."' border='0' cellspacing='0' cellpadding='2'>"
	."<tr>"
    ."<td class='topnav' width='".$tmcol[0]."' nowrap><font class='content' color='#363636'></font></td>"
    ."</tr><tr>"
	."<td width='".$tmcol[5]."'><img src='themes/$thename/images/pixel.gif' width='".$tmcol[5]."' height='".$tmrow[1]."' border='0' alt=''></td></tr>"
    ."</table>"
    ."<table width='".$tmcol[0]."' cellpadding='0' cellspacing='0' border='0' align='center'>"
	."<tr valign='top'>"
	."<td width='".$tmcol[1]."'><img src='themes/$thename/images/pixel.gif' width='".$tmcol[1]."' height='".$tmrow[2]."' border='0' alt=''></td>\n"
    ."<td width='".$tmcol[2]."' valign='top'>";

    blocks('left');

echo "</td>"
	."<td width='".$tmcol[5]."'><img src='themes/$thename/images/pixel.gif' width='".$tmcol[5]."' height='".$tmrow[1]."' border='0' alt=''></td>"
	."<td valign='top' width='".$tmcol[0]."'>";

include ("themes/$thename/cblock.php");
	
	if (!empty($GLOBALS["home"])) {
		blocks('center');
		}
}

/************************************************************/
/* Function themefooter()                                   */
/************************************************************/

function themefooter() {
	global $thename, $tmcol, $tmrow, $bgcolor2, $bgcolor4;
	if (!empty($GLOBALS['index'])) {
		if (!empty($GLOBALS["home"])) {
			blocks('down');
			}

echo	"</td>"
		."<td><img src='themes/$thename/images/pixel.gif' width='5' height='1' border='0'>"   
		."<td width='165' valign='top'>";

		blocks("right");

	}
echo "</td>"
    ."<td><img src='themes/$thename/images/pixel.gif' width='5' height='1' border='0'></td>"
    ."</td></tr></table>"
	."</td></tr></table>"
	."<table cellspacing='0' cellpadding='0' width='".$tmcol[0]."' align='center' border='0' bgcolor='$bgcolor4'>"
	."<tr>"
	."<td class='topnav' width='".$tmcol[0]."' nowrap><font class='content' color='#363636'></font></td>"
	."</tr>"
	."</table>"
	."<table width='".$tmcol[0]."' cellpadding='0' cellspacing='0' border='0' bordercolor='$bgcolor2' align='center' class='buttonbkg' height='80'>";
	if ($GLOBALS['bannersfsz']) {
		echo "<tr><td width='50%'><center>".footmsg('asvar')."</center></td>"
		."<td width='50%'><center>";
		include_once("bannersfsz.php");
		echo "</center></td></tr>";
		}
	else {
		echo "<tr><td><center>".footmsg('asvar')."</center></td></tr>";
		}
	# echo "</table>"
	# ."<div class='footmsg_l' align='center'>".mxViewBench()."</div>";
	}

################################################################
function getThemeAdminname($story) {
	global $prefix;
	if (!empty($story['url'])) {
		$story['aid'] = "<a href='".$story['url']."' target='new'>".$story['aid']."</a>";
		} 
	else if (!empty($story['email'])) {
		$story['aid'] = "<a href='mailto:".mxPrepareToDisplay($story['email'])."'>".$story['aid']."</a>";
		} 
	return $story['aid'];
	}

################################################################
function themeindex($x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $story=array()) {
	global $thename, $tmcol, $bgcolor1;
	static $img;
	if (empty($img)) {
		$img[0] = mxCreateImage("themes/$thename/images/dotr.gif", "", 0, "align='right'");
		$img[1] = mxCreateImage("themes/$thename/images/buttons/informant.gif", "", 0);
		$img[2] = mxCreateImage("themes/$thename/images/buttons/print.gif", "", 0);
		$img[3] = mxCreateImage("themes/$thename/images/buttons/friend.gif", "", 0);
		$img[5] = mxCreateImage("themes/$thename/images/buttons/comments.gif", "", 0);
		$img[6] = mxCreateImage("themes/$thename/images/buttons/bytesmore.gif", "", 0);
		if ($GLOBALS['articlecomm']) $img[4] = mxCreateImage("themes/$thename/images/buttons/counter.gif", "", 0);
		}
	$bmore = ($story['allmorelink']['bodycount']) ?  " (".$story['allmorelink']['totalcount']." "._BYTESMORE.")" : "";
	$link[] = "".$story['allmorelink']['storylink']."<span title='"._READMORE."".$bmore."'>".$img[6]."</span></a>";
	if (!empty($story['informant']) && (mxIsUser() || mxIsAdmin())) {
		$link[] = "".$story['allmorelink']['informantlink']."".$img[1]."</a>";
		}
	$link[] = "".$story['allmorelink']['printerlink']."".$img[2]."</a>";
	if (mxIsUser()) {
		$link[] = "".$story['allmorelink']['friendlink']."".$img[3]."</a>";
		}
	if ($story['acomm'] && $GLOBALS['articlecomm']) {
		$link[] = "".$story['allmorelink']['commentslink']."".$img[5]."</a>";
		}
	$link[] = "<a title='".$story['allmorelink']['counter'].", ".$story['allmorelink']['score']."'>".$img[4]."</a>";

	$topicimage  = mxCreateImage($GLOBALS['tipath'].$story['topicimage'], _TOPIC.": ".$story['topictext'], 0, "align='left' style='padding-right: 10px; padding-bottom: 5px;'");
	$authorinfo  = (empty($story['informant'])) ? "" : "<i>".$story['allmorelink']['informantlink']."".$story['informant']."</a> "._WRITES.":</i><br><br>";
	$authorinfo  = ($story['aid'] == $story['informant']) ? "" : $authorinfo;
	$readmore    = (empty($bmore)) ? "" : "<div align='right'>".$story['allmorelink']['more']."</div>";
	$notes       = (empty($notes)) ? "" : "<br><br><span class='tiny'><b>"._NOTE."</b> <i>".$notes."</i></span>\n";
	$content = "<a href='modules.php?name=News&new_topic=".$story['topic']."'>".$topicimage."</a>".$authorinfo."\n".$story['hometext']."\n".$readmore."\n".$notes;

	echo ""
	."<table width='100%' border='0' cellspacing='1' cellpadding='0'><tr><td>"
	."<table width='100%' border='0' cellspacing='0' cellpadding='1' bgcolor='#FFFFFF'><tr valign='middle'>"
	
	."<td height='21' background='themes/$thename/images/cellpic3.gif' bgcolor='$bgcolor1'><div class='storytitle'><b>".strip_tags($story['title'])."</b></div></td>\n"
	."<td width='1%' height='21' background='themes/$thename/images/cellpic3.gif' bgcolor='$bgcolor1'>".join($link, "</td>\n<td width='1%' height='21' background='themes/$thename/images/cellpic3.gif' bgcolor='$bgcolor1'>")."</td>\n"
	
	."</tr></table>"
	."<table width='100%' border='0' cellspacing='5' cellpadding='0' bgcolor='$bgcolor1'>"
	."<tr><td class='content'>".$content."</td></tr>"
	."</table>"
	."</td></tr></table><br>\n\n";
	}

################################################################
function themearticle($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext,$story=array()) {
	global $admin, $sid, $anonymous, $tipath, $thename, $tmcol, $bgcolor1;
	extract($story,EXTR_OVERWRITE);
	$topicimage = mxCreateImage($tipath.$topicimage, $topictext, 0, "align='left' style='padding-right: 10px; padding-bottom: 5px;'");
	$authorinfo  = (empty($informant)) ? "" : "<i><a href='modules.php?name=Userinfo&amp;uname=".$informant."'>".$informant."</a> "._WRITES.":</i><br><br>";
	$authorinfo  = ($aid == $informant) ? "" : $authorinfo;
	$notes     = (empty($notes)) ? "" : "<br><br><span class='tiny'><b>"._NOTE."</b> <i>".$notes."</i></span>\n";

	echo ""
	."<table width='100%' border='0' cellspacing='1' cellpadding='0'><tr><td>"
	."<table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='$bgcolor1'>"
	
	."<tr><td height='21' background='themes/$thename/images/cellpic3.gif' bgcolor='$bgcolor1'><div class='storytitle'>" #
	."<b>".strip_tags($story['title'])."</b>"
	."</div></td></tr>"
	
	."<tr><td><div style='background: $bgcolor1; width: 100%;'>" # class='content'
	."<br><a href='modules.php?name=News&new_topic=".$topic."'>".$topicimage."</a>"
	."".$authorinfo."\n".$bodytext."<br><br>\n</div>\n".$notes."\n"
	."</td></tr>"
	
	."</table>"
	."</td></tr></table>\n\n";
	}

################################################################
function themesidebox($title, $content, $block=array()) {

global $bgcolor1, $bgcolor2, $thename, $tmcol;

echo "<table width='".$tmcol[2]."' border='1' cellspacing='0' cellpadding='0'>"
	."<tr>"
	."<td height='21' background='themes/$thename/images/cellpic3.gif' bgcolor='$bgcolor1'>"
	."<font class='content' color='$bgcolor2'><center><strong>$title</strong></center></font>"
	."</td>"
	."</tr>"
	."<tr>"
	."<td bgcolor='$bgcolor1'><font class='content'>$content</font></td>"
	."</tr>"
	."</table><br>";
}

	

################################################################
function thememiddlebox($title,$content,$block=array()) {

global $bgcolor1, $bgcolor2, $thename, $tmcol;

echo "<table width='".$tmcol[0]."' border='0' cellspacing='0' cellpadding='0'>"
	."<tr>"
	."<td height='21' background='themes/$thename/images/cellpic3.gif' bgcolor='$bgcolor1'>"
	."<font class='content' color='$bgcolor2'><center><strong>$title</strong></center></font>"
	."</td>"
	."</tr>"
	."<tr>"
	."<td bgcolor='$bgcolor1'><font class='content'>$content</font></td>"
	."</tr>"
	."</table><br>";
}

?>