<?php

$bgcolor1 = "#ffffff";
$bgcolor2 = "#cccccc";
$bgcolor3 = "#ffffff";
$bgcolor4 = "#eeeeee";
$textcolor1 = "#ffffff";
$textcolor2 = "#000000";

function OpenTable() {
    global $bgcolor1, $bgcolor2;
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td>\n";
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function OpenTable2() {
    global $bgcolor1, $bgcolor2;
    echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\" align=\"center\"><tr><td>\n";
    echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function CloseTable() {
    echo "</td></tr></table></td></tr></table>\n";
}

function CloseTable2() {
    echo "</td></tr></table></td></tr></table>\n";
}

function FormatStory($thetext, $notes, $aid, $informant) {
    global $anonymous;
    if ($notes != "") {
	$notes = "<b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
	$notes = "";
    }
    if ("$aid" == "$informant") {
	echo "<p style=\"background: url(themes/coffee4arab6/images/artback.gif)\"><font style=\"line-height:20px;\">$thetext<br>$notes</font>\n";
    } else {
	if($informant != "") {
	    $boxstuff = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
	} else {
	    $boxstuff = "$anonymous ";
	}
	$boxstuff .= ""._WRITES." <i>\"$thetext\"</i> $notes\n";
	echo "<p style=\"background: url(themes/coffee4arab6/images/artback.gif)\"><font style=\"line-height:20px;\">$boxstuff</font>\n";
    }
}

function themeheader() {
    echo "<body bgcolor=\"#D8D9DA\" text=\"000000\" link=\"0000ff\" vlink=\"0000ff\">"
	."<br>";
	$myad = ads(0);
	echo "$myad";
    echo "<br>"
	."<table style=\"border:1px solid #828383\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" width=\"770\" align=\"center\"><tr><td bgcolor=\"ffffff\">"
        ."<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\" bgcolor=\"ffffff\"><tr><td>"
        ."<a href=\"index.php\"><img src=\"themes/coffee4arab6/images/logo.gif\" alt=\"Welcome to $sitename\" title=\"Welcome to $sitename\" border=\"0\"></a>"
        ."</td></tr></table>"
		."</td></tr><tr><td valign=\"top\" width=\"100%\" bgcolor=\"ffffff\">";
    $public_msg = public_message();
    echo "$public_msg<br>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\"><tr><td valign=\"top\" width=\"150\" bgcolor=\"ffffff\">";
	echo "\n<!-- هذا الثييم من تصميم قهوة نت -->\n<!-- الرجاء عدم إزالة الحقوق -->\n";
    blocks("left");
    echo "<img src=\"images/pix.gif\" border=\"0\" width=\"150\" height=\"1\"></td><td>&nbsp;&nbsp;</td><td width=\"100%\" valign=\"top\">";
}

function themefooter() {
    if (defined('INDEX_FILE')) {
	echo "</td><td>&nbsp;&nbsp;</td><td valign=\"top\" bgcolor=\"#ffffff\">";
	blocks("right");
	echo "</td>";
    }
    echo "</td></tr></table>";
	echo "<center><br><table width=\"100%\" style=\"border:dashed 1px #F9F5DC\" border=0><tr><td align=\"center\">";
    footmsg();
	echo "</td></tr></table></center>";

	echo "</td></tr></table>";
}

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous;

	// copyright: coffee4arab.com. DO NOT REMOVE THIS PLEASE.
    preg_match("/sid=([0-9]{1,})/", $morelink, $matches);


    echo "<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\"><tr><td>"
        ."<table bgcolor=#F9F5DC cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>"
		."<td bgcolor=#F9F5DC background=\"themes/coffee4arab6/images/arttop.gif\" height=60>"

        ."<b><font class=title>$title</b><br>"
        ."<font class=\"tiny\">"
        .""._POSTEDBY." <b>";
    formatAidHeader($aid);
    echo "</b> "._ON." $time $timezone ($counter "._READS.")<br>"
//	."<b>"._TOPIC."</b> <a href=\"modules.php?name=News&amp;new_topic=$topic\">$topictext</a><br>"
	."</font></td></tr><tr><td bgcolor=\"#F9F5DC\">";
    FormatStory($thetext, $notes, $aid, $informant);
    echo "<br><br>"
        ."</td></tr>"
//        ."<font class=\"content\">$morelink</font>"
        ."</td></tr></table>"
		."<tr><td height=30 bgcolor=#F9F5DC align=\"left\">"
		."<a href=\"modules.php?name=News&amp;file=article&amp;".$matches[0]."\">"
		."<img src=\"themes/coffee4arab6/images/more.jpg\" border=\"0\"></a>"

		."</td></tr></table>"
	."<br>";
}

function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
    global $admin, $sid, $admin_file;
    if ("$aid" == "$informant") {
		echo"
		<table border=0 cellpadding=0 cellspacing=0 align=center width=100%><tr><td>
		<table border=0 cellpadding=0 cellspacing=0 width=100%><tr>
		<td bgcolor=#F9F5DC background=\"themes/coffee4arab6/images/arttop.gif\" height=60>
		<b><font class=title>$title</font></b><br><font class=tiny>بتاريخ $datetime";
		if ($admin) {
		    echo "&nbsp;&nbsp; $font2 [ <a href=".$admin_file.".php?op=EditStory&sid=$sid>تعديل</a> | <a href=".$admin_file.".php?op=RemoveStory&sid=$sid>حذف</a> ]";
		}
		echo "
		الموضوع: <a href=modules.php?name=News&amp;new_topic=$topic>$topictext</a>
		</td></tr>
		<tr><td bgcolor=#F9F5DC><p style=\"background: url(themes/coffee4arab6/images/artback.gif)\">
		<font style=\"line-height:20px;\">$thetext
		</td>
		</tr></table></td></tr></table><br>";
    } else {
		if($informant != "") $informant = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&username=$informant\">$informant</a> ";
			else $boxstuff = "$anonymous ";
			$boxstuff .= "writes <i>\"$thetext\"</i> $notes";
			echo "
			<table border=0 cellpadding=0 cellspacing=0 align=center bgcolor=000000 width=100%><tr><td>
			<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=FFFFFF>
			<b>$title</b><br><font class=content>كتبت بواسطة $informant في $datetime</font>";
			if ($admin) {
			    echo "&nbsp;&nbsp; $font2 [ <a href=".$admin_file.".php?op=EditStory&sid=$sid>تعديل</a> | <a href=".$admin_file.".php?op=RemoveStory&sid=$sid>حذف</a> ]";
			}
		echo "
		<br>الموضوع: <a href=modules.php?name=News&amp;new_topic=$topic>$topictext</a>
		</td></tr><tr><td bgcolor=ffffff><p style=\"background:#DD2068 url(themes/coffee4arab6/images/artback.gif)\">
		<font style=\"line-height:20px;\">$thetext
		</td></tr></table></td></tr></table><br>";
    }
}

function themesidebox($title, $content) {
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"150\"><tr><td>"
        ."<table bgcolor=\"#F9F5DC\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"center\">"
        ."<b>$title</b></td></tr>"
		."<tr><td background=\"themes/coffee4arab6/images/blocktop.gif\"><img src=\"images/pix.gif\" height=\"4\"></td></tr>"
		."<tr><td><font class=\"content\">"
        ."$content"
	."</font><br></td></tr></table></td></tr></table><br>";
}

?>