<?php

/************************************************************/
/* IMPORTANT NOTE FOR THEMES DEVELOPERS!		    */
/*							    */
/* When you start coding your theme, if you want to	    */
/* distribute it, please double check it to fit the HTML    */
/* 4.01 Transitional Standard. You can use the W3 validator */
/* located at http://validator.w3.org			    */
/* If you don't know where to start with your theme, just   */
/* start modifying this theme, it's validate and is cool ;) */
/************************************************************/

/************************************************************/
/* Тема для PHP-Nuke 6.5				    */
/*							    */
/* Идея и цветовая гамма www.netcity.ru 		    */
/* Адаптация к PHP-Nuke выполнена www.rus-phpnuke.com	    */
/*							    */
/************************************************************/

/************************************************************/
/* Theme Colors Definition				    */
/************************************************************/

$bgcolor1 = "#ffffff";
$bgcolor2 = "#CCCCCC";
$bgcolor3 = "#EFEFEF";
$bgcolor4 = "#CCCCCC";
$textcolor1 = "#000000";
$textcolor2 = "#000000";

/************************************************************/
/* OpenTable Functions					    */
/************************************************************/

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=\"10\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function CloseTable() {
    echo "</td></tr></table></td></tr></table>\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=\"10\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

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

/************************************************************/
/* FormatStory						    */
/************************************************************/

function FormatStory($thetext, $notes, $aid, $informant) {
    global $anonymous;
    if ($notes != "") {
	$notes = "<br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
	$notes = "";
    }
    if ("$aid" == "$informant") {
	echo "<font class=\"content\">$thetext $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." \"$thetext\"$notes\n";
	echo "<font class=\"content\">$boxstuff</font>\n";
    }
}

/************************************************************/
/* Function themeheader()				    */
/************************************************************/

function themeheader() {
    global $banners, $user, $cookie, $prefix, $dbi, $module_name, $db, $user_prefix, $sitekey, $ads;
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
       $username = "Anonymous";
   }

    echo "<BODY bgColor=\"#ffffff\" topmargin=\"0\" leftmargin=\"20\">\n";
    echo "<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr>\n"
    ."<td width=\"30%\"><a href=\"http://rus-phpnuke.com\"><img border=\"0\" src=\"themes/RusNuke2003/images/logo.gif\" alt=\"PHP-Nuke по-русски\" width=\"200\" height=\"55\"></a></td>\n"
    ."<td width=\"20%\">&nbsp;</td>\n"
    ."<td width=\"10%\" valign=\"top\">&nbsp;<a class=topmenu href=\"index.php\">Главная</a>\n"
    ."<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr>\n"
    ."<td bgcolor=\"#2D496E\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"3\" height=\"30\"></td>\n"
    ."<td width=\"100%\"><font class=topsmall>Начальная<br>страница</font></td></tr></table></td>\n"
    ."<td width=\"10%\" valign=\"top\">&nbsp;<a class=topmenu href=\"modules.php?name=FAQ\">ЧаВо</a>\n"
    ."<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr>\n"
    ."<td bgcolor=\"#2D496E\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"3\" height=\"30\"></td>\n"
    ."<td width=\"100%\"><font class=topsmall>Вопросы<br>и ответы</font></td></tr></table>\n"
    ."</td>"
    ."<td width=\"10%\" valign=\"top\">&nbsp;<a class=topmenu href=\"modules.php?name=Topics\">Разделы</a>\n"
    ."<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr>\n"
    ."<td bgcolor=\"#2D496E\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"3\" height=\"30\"></td>\n"
    ."<td width=\"100%\"><font class=topsmall>Наши<br>темы</font></td></tr></table>\n"
    ."</td><td width=\"10%\" valign=\"top\">&nbsp;<a class=topmenu href=\"modules.php?name=Web_Links\">Ссылки</a>\n"
    ."<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr>\n"
    ."<td bgcolor=\"#2D496E\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"3\" height=\"30\"></td>\n"
    ."<td width=\"100%\"><font class=topsmall>Каталог<br>сайтов</font></td></tr></table>\n"
    ."</td><td width=\"10%\" valign=\"top\">&nbsp;<a class=topmenu href=\"modules.php?name=Downloads\">Файлы</a>\n"
    ."<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr>\n"
    ."<td bgcolor=\"#2D496E\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"3\" height=\"30\"></td>\n"
    ."<td width=\"100%\"><font class=topsmall>Каталог<br>программ</font></td></tr></table></td>\n"
    ."<td width=\"10%\" valign=\"top\">&nbsp;<a class=topmenu href=\"modules.php?name=Forums\">Форум</a>\n"
    ."<table border=\"0\" cellpadding=\"0\" width=\"100%\">\n"
    ."<tr><td bgcolor=\"#2D496E\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"3\" height=\"30\"></td>\n"
    ."<td width=\"100%\"><font class=topsmall>Форумы<br>поддержки</font></td></tr></table></td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"20\" bgColor=#2d496e height=\"20\">\n"
    ."<tr><td width=\"70%\">\n";

    if ($username == "Anonymous")
{
       mt_srand ((double)microtime()*1000000);
       $maxran = 1000000;
       $random_num = mt_rand(0, $maxran);
       $datekey = date("F j");
       $rcode = hexdec(md5(".$_SERVER[HTTP_USER_AGENT]." . $sitekey . $random_num . $datekey));
       $code = substr($rcode, 2, 6);
    echo "<form action=\"modules.php?name=Your_Account\" method=\"post\"  style=\"display: inline\">\n"
    ."<input type=\"hidden\" name=\"op\" value=\"login\">&nbsp; <font class=A_white>Логин:</font>\n"
    ."<input type=\"text\" name=\"username\" maxlength=\"25\">\n"
    ."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n"
    ."<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">\n"
    ."<font class=A_white>Пароль:</font> <input type=\"password\" name=\"user_password\" maxlength=\"20\">\n"
    ."<input type=\"submit\" value=\"Вход\"></form>\n";
}
    else
{
    echo "&nbsp;&nbsp;<font class=A_white>Здравствуйте $username !</font></b>";
}

    echo "</td><td width=\"30%\"><p align=\"right\"><font class=A_white><b>"
    ."<script type=\"text/javascript\">\n\n"
	."<!--	 // Array ofmonth Names\n"
	."var monthNames = new Array( \"Января\",\"Февраля\",\"Марта\",\"Апреля\",\"Мая\",\"Июня\",\"Июля\",\"Августа\",\"Сентября\",\"Октября\",\"Ноября\",\"Декабря\");\n"
	."var now = new Date();\n"
	."thisYear = now.getYear();\n"
	."if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem\n"
	."document.write(now.getDate() + \" \" + monthNames[now.getMonth()] + \", \" + thisYear + \"&nbsp;года\");\n"
	."// -->\n"
	."</script>\n"
	."</font></b>;\n"
	."</td></tr></table>";

if ($username == "Anonymous")
{
   echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"2\">\n"
    ."<tr><td width=\"100%\"></td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
    ."<tr><td width=\"30%\" bgColor=#eeeee4><table border=0 cellspacing=0 cellpadding=6><tr>\n"
    ."<td valign=middle><ul>\n"
    ."<li><A HREF=\"modules.php?name=Your_Account&op=new_user\" CLASS=A_black>Регистрация</A>\n"
    ."<li><A HREF=\"modules.php?name=Your_Account&op=pass_lost\" CLASS=A_black>Забыли пароль?</A>\n"
    ."<li><A HREF=\"modules.php?name=Your_Account&op=pass_lost\" CLASS=A_black>Помощь</A>\n"
    ."</td></tr></table></td><td width=\"70%\">\n";
}
else
{
   echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"2\">\n"
    ."<tr><td width=\"100%\"></td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
    ."<tr><td width=\"30%\" bgColor=#eeeee4>\n"
    ."<table border=0 cellspacing=0 cellpadding=6><tr>\n"
    ."<td valign=middle><ul>\n"
    ."<li><A HREF=\"modules.php?name=Your_Account\" CLASS=A_black>Ваш аккаунт</A>\n"
    ."<li><A HREF=\"modules.php?name=Private_Messages\" CLASS=A_black>Приватные сообщения</A>\n";
    if (is_active("Private_Messages")) {
			$sql = "SELECT user_id FROM ".$user_prefix."_users WHERE username='$username'";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$uid = $row[user_id];
			$numrow = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5' OR privmsgs_type='0')"));
			$newpm = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='5' OR privmsgs_type='1')"));
			
			if ($newpm > 0) {
				echo "<img border=\"0\" src=\"images/pm.gif\" align=\"absmiddle\" width=\"16\" height=\"15\"> (<b>$newpm</b>)";
			}
else {
echo "(<b>$newpm</b>)";
}
}
    echo "<li><A HREF=\"modules.php?name=Your_Account&op=logout\" CLASS=A_black>Выход</A>\n"
    ."</td></tr></table></td><td width=\"70%\"><center>\n";
}
	$ads = ads(0);
	echo "$ads";
	echo "<br>";


   echo "</center></td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"2\">\n"
    ."<tr><td width=\"100%\"></td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgColor=#ff9900 height=\"20\">\n"
    ."<tr><td width=\"60%\">\n"
    ."<form action=\"modules.php?name=Search\" method=\"post\" style=\"display: inline\">\n"	     ."&nbsp;&nbsp;<font class=A_white>Поиск:</font>\n"
    ."<input size=\"55\" type=\"text\" name=\"query\" value=\"\">\n"
    ."&nbsp;<input type=\"submit\" value=\"Искать\"></form></td><td width=\"40%\">
</td></tr></table>\n"
    ."<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td width=\"100%\">\n";

    $public_msg = public_message();

    echo "$public_msg</td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
    ."<tr><td width=\"100%\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"1\" height=\"10\"></td></tr></table>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
    if ($module_name == "Forums") {
    echo "<tr><td width=\"100%\" valign=\"top\">\n";
    }
    else {
    echo "<tr><td width=\"160\" valign=\"top\">\n";
      blocks(left);
    echo "<br><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"160\" height=\"1\">";
    echo "</td><td><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"10\" height=\"1\"></td><td valign=\"top\" width=\"90%\">";
    }
}

/************************************************************/
/* Function themefooter()				    */
/************************************************************/

function themefooter() {
    global $module_name;
if (!defined('INDEX_FILE') OR ($module_name == "Forums")) {
    echo "</td></tr></table>\n";
}

else {
    echo "</td><td><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"10\" height=\"1\"></td><td valign=\"top\" width=\"160\">";
    blocks(right);
    echo "<br><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"160\" height=\"1\"></td></tr></table>\n";
}

    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
    ."<tr><td width=\"100%\"></td></tr></table><br>\n"
    ."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgColor=#ff9900>\n"
    ."<tr><td><a href=\"#\"><img border=\"0\" src=\"themes/RusNuke2003/images/top.gif\" width=\"22\" height=\"22\"></a>\n"
    ."</td><td width=\"100%\"><center><font class=A_white>\n"
    ."<a class=A_white href=\"modules.php?name=Stories_Archive\">Архив статей</a>\n"
    ."&nbsp;<strong>::</strong>&nbsp;<a class=A_white href=\"modules.php?name=Submit_News\">\n"
    ."Добавить новость</a>&nbsp;<strong>::</strong>&nbsp;<a class=A_white href=\"modules.php?name=Feedback\">\n"
    ."Контакт с автором</a>&nbsp;<strong>::</strong>&nbsp;\n"
    ."<a class=A_white href=\"modules.php?name=Recommend_Us\">Рекомендовать Нас</a>\n"
    ."</font></center></td><td><a href=\"#\"><img border=\"0\" src=\"themes/RusNuke2003/images/top.gif\" width=\"22\" height=\"22\"></a></td></tr>\n"
    ."</table><br>";
    

echo "<center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"80%\">\n"
    ."<tr><td width=\"100%\"><center><span style=\"visibility: hidden\"><font class=topsmall>\n"
    ."RusNuke2003 theme by <a href=\"http://rus-phpnuke.com\"><font class=\"footmsg_l\">PHP-Nuke по-русски</font></span></a><br>\n";
    footmsg();
    echo "</font></center></td></tr></table></center>\n";

}

/************************************************************/
/* Function themeindex()				    */
/************************************************************/

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous, $tipath;
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>\n"
    ."<td width=\"100%\"><p align=\"justify\"><font class=storytitle>$title</font><br>\n"
    ."<font class=grey>[$time]</font>&nbsp;\n";
    FormatStory($thetext, $notes, $aid, $informant);
    echo"<br><center>$morelink</center></td></tr></table><br><hr size=\"1\" color=\"#CCCCCC\">\n";
}

/************************************************************/
/* Function themearticle()				    */
/************************************************************/

function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
    global $admin, $sid, $tipath;
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
    ."<td width=\"100%\"><font class=\"storytitle\">$title</font><p align=\"justify\">\n"
    ."<a href=\"modules.php?name=News&new_topic=$topic\">\n"
    ."<img src=\"$tipath$topicimage\" alt=\"$topictext\" border=\"0\" align=\"left\"></a>\n";
    FormatStory($thetext, $notes="", $aid, $informant);
    echo "<br><br>"._POSTEDBY." ";
    formatAidHeader($aid);
    echo "&nbsp;<font class=grey>[$datetime]</p>\n"
    ."</td></tr></table>\n";
}

/************************************************************/
/* Function themesidebox()				    */
/************************************************************/

function themesidebox($title, $content)
{
  echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
    ."<tr><td width=\"100%\" bgcolor=\"#EEEEE4\">\n"
    ."<p align=\"right\" class=menu>$title&nbsp;</td></tr><tr>\n"
    ."<td width=\"100%\"><img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"1\" height=\"1\"></td>\n"
    ."</tr><tr><td width=\"100%\" bgcolor=\"#2D496E\">\n"
    ."<img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"1\" height=\"3\"></td>\n"
    ."</tr><tr><td width=\"100%\">\n"
    ."<img border=\"0\" src=\"themes/RusNuke2003/images/pixel.gif\" width=\"1\" height=\"3\"></td>\n"
    ."</tr><tr><td width=\"100%\"><font class=block>$content</font></td></tr></table><br>\n";

}

?>
