<?php


//*********************************************************************************************************//
// Theme Name: zoneBlue Theme - Original Design by: yassineb - Ported for PHP-Nuke by: Nukemods)
// Redesigned and modified by Lorkan Themes (http://lorkan.com)
// version 1.0
//
// Lorkan Themes and/or Lorkan is a Registered Organization and holds a copyright with CIPO
// (Canadian Intellectual Property Office)
// Original Author of file: Lorkan Themes - http://lorkan.com
// Developed by: Lorkan Themes - Simply The Best Themes for Nuke
// Forum Template: Desgined by Subblue Designs, but ported by: Lorkan Themes for use with PHP-Nuke©
// Copyright © 2004 by Lorkan Themes - All Rights Reserved
// ----------------------------------------------------------------------
// THEME MODIFICATION
// Users may alter or modify this theme at their own risk,
// but only for their own use. They may also hire Lorkan Themes to modify their own copy of the theme.
// Although users may modify the code for their use,
// modified code may not be resold or distributed,
// without express written permission from Lorkan Themes.
//
// DISPLAY OF COPYRIGHT NOTICES REQUIRED
// All copyright notices used within the scripts that the scripts generate,
// MUST remain intact. Furthermore, these notices must remain visible.
//
// SUPPORT
// Lorkan Themes provide free support on all their theme designs, BUT not on Forum Templates,
// (includes consulting, troubleshooting and fixing problems).
//
// Lorkan Themes is not liable for any products or services offered by means of the theme.
// The user must assume the entire risk of using the program.
//
// Lorkan Themes
// For commercial themes, exclusive themes, visit our Theme Shop http://lorkan.com/modules.php?name=Themes
// For some free themes, visit us at: http://lorkan.com
//*********************************************************************************************************//

/************************************************************/
/* Theme Colors Definition                                  */
/*                                                          */
/* Define colors for your web site. $bgcolor2 is generaly   */
/* used for the tables border as you can see on OpenTable() */
/* function, $bgcolor1 is for the table background and the  */
/* other two bgcolor variables follows the same criteria.   */
/* $texcolor1 and 2 are for tables internal texts           */
/************************************************************/

$bgcolor1 = "#0C1F50";
$bgcolor2 = "#0C1F50";
$bgcolor3 = "#0C1F50";
$bgcolor4 = "#6D6D6D";
$textcolor1 = "#FFFFFF";
$textcolor2 = "#FFFFFF";

include("themes/zoneBlue/tables.php");

/************************************************************/
/* Function themeheader()                                   */
/*                                                          */
/* Control the header for your site. You need to define the */
/* BODY tag and in some part of the code call the blocks    */
/* function for left side with: blocks(left);               */
/************************************************************/


function themeheader() {
    global  $admin, $user, $banners, $name, $sitename, $slogan, $cookie, $prefix, $db, $nukeurl, $anonymous;
    if ($banners == 1) {
    $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner WHERE type='0' AND active='1'"));
   /* Get a random banner if exist any. */
   /* More efficient random stuff, thanks to Cristian Arroyo from com.ar */

    if ($numrows>1) {
   $numrows = $numrows-1;
   mt_srand((double)microtime()*1000000);
   $bannum = mt_rand(0, $numrows);
    } else {
   $bannum = 0;
    }
    $sql = "SELECT bid, imageurl, clickurl, alttext FROM ".$prefix."_banner WHERE type='0' AND active='1' LIMIT $bannum,1";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $bid = $row[bid];
    $imageurl = $row[imageurl];
    $clickurl = $row[clickurl];
    $alttext = $row[alttext];

    if (!is_admin($admin)) {
       $db->sql_query("UPDATE ".$prefix."_banner SET impmade=impmade+1 WHERE bid='$bid'");
    }
    if($numrows>0) {
   $sql2 = "SELECT cid, imptotal, impmade, clicks, date FROM ".$prefix."_banner WHERE bid='$bid'";
   $result2 = $db->sql_query($sql2);
   $row2 = $db->sql_fetchrow($result2);
   $cid = $row2[cid];
   $imptotal = $row2[imptotal];
   $impmade = $row2[impmade];
   $clicks = $row2[clicks];
   $date = $row2[date];

/* Check if this impression is the last one and print the banner */

   if (($imptotal <= $impmade) AND ($imptotal != 0)) {
       $db->sql_query("UPDATE ".$prefix."_banner SET active='0' WHERE bid='$bid'");
       $sql3 = "SELECT name, contact, email FROM ".$prefix."_bannerclient WHERE cid='$cid'";
       $result3 = $db->sql_query($sql3);
       $row3 = $db->sql_fetchrow($result3);
       $c_name = $row3[name];
       $c_contact = $row3[contact];
       $c_email = $row3[email];
       if ($c_email != "") {
      $from = "$sitename <$adminmail>";
      $to = "$c_contact <$c_email>";
      $message = ""._HELLO." $c_contact:\n\n";
      $message .= ""._THISISAUTOMATED."\n\n";
      $message .= ""._THERESULTS."\n\n";
      $message .= ""._TOTALIMPRESSIONS." $imptotal\n";
      $message .= ""._CLICKSRECEIVED." $clicks\n";
      $message .= ""._IMAGEURL." $imageurl\n";
      $message .= ""._CLICKURL." $clickurl\n";
      $message .= ""._ALTERNATETEXT." $alttext\n\n";
      $message .= ""._HOPEYOULIKED."\n\n";
      $message .= ""._THANKSUPPORT."\n\n";
      $message .= "- $sitename "._TEAM."\n";
      $message .= "$nukeurl";
      $subject = "$sitename: "._BANNERSFINNISHED."";
      mail($to, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
       }
   }
    $showbanners = "<a href=\"banners.php?op=click&bid=$bid\" target=\"_blank\"><img src=\"$imageurl\" border=\"0\" alt='$alttext' title='$alttext'></a>";
    }
}
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
    echo "<body text=\"#FFFFFF\" leftmargin=\"5\" topmargin=\"10\" marginwidth=\"10\" marginheight=\"10\">\n";

    if ($username == "Anonymous") {
        $theuser = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account\">Login</a>";
    } else {
        $theuser = "&nbsp;&nbsp;Welcome $username!";
    }
    $tmpl_file = "themes/zoneBlue/header.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
    if ($name=='DisError') {
    } else {
        blocks(left);
    }
    $tmpl_file = "themes/zoneBlue/left_center.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themefooter()                                   */
/*                                                          */
/* Control the footer for your site. You don't need to      */
/* close BODY and HTML tags at the end. In some part call   */
/* the function for right blocks with: blocks(right);       */
/* Also, $index variable need to be global and is used to   */
/* determine if the page your're viewing is the Homepage or */
/* and internal one.                                        */
/************************************************************/
function themefooter() {
    global $index, $foot1, $foot2, $foot3, $foot4, $copyright, $totaltime, $footer_message;
    if ($index == 1) {
	$tmpl_file = "themes/zoneBlue/center_right.html";
	$thefile = implode("", file($tmpl_file));
	$thefile = addslashes($thefile);
	$thefile = "\$r_file=\"".$thefile."\";";
	eval($thefile);
	print $r_file;
	blocks(right);
    }/*
      <td width="16" background="themes/zoneBlue/forums/images/darkSilver_31.gif"><img src="images/spacer.gif" width="16" height="1"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="35"><IMG SRC="themes/zoneBlue/forums/images/darkSilver_34.gif" WIDTH=35 HEIGHT=56 ALT=""></td>
    <td background="themes/zoneBlue/forums/images/darkSilver_35.gif">&nbsp;</td>
    <td width="35"><IMG SRC="themes/zoneBlue/forums/images/darkSilver_38.gif" WIDTH=35 HEIGHT=56 ALT=""></td>
  </tr>
</table>

</td></tr></table> */
echo "<td width=\"16\" background=\"themes/zoneBlue/forums/images/darkSilver_31.gif\"><img src=\"images/spacer.gif\" width=\"16\" height=\"1\"></td>
  </tr>
</table>
<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
."<tr>\n"
."<td width=\"15\" background=\"themes/zoneBlue/forums/images/darkSilver_28.gif\"><img src=\"images/spacer.gif\" width=\"15\" height=\"1\"></td>\n"
."<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\"#0C1F50\">\n"
."<tr>\n"
."<td class=\"small\"><center><font class=\"small\">\n";
footmsg();
echo"</font></center></td>\n"
."</tr>\n"
."<tr>\n";
// PLEASE DO NOT TOUCH THE NEXT LINE.
// YOU CAN ONLY ADD TO IT IF YOU MODIFY THIS THEME :-)
echo "<td class=\"small\"><center><font class=\"small\">:: zoneBlue Theme - Original style by yassineb :: PHP-Nuke theme by Nukemods - Re-designed by: <a target=\"_blank\" href=\"http://lorkan.com\">Lorkan Themes</a> ::</font></center></td>\n"
."</tr>\n"
."<tr>\n"
."<td>&nbsp;</td>\n"
."</tr>\n"
."</table></td>\n"
."<td width=\"16\" background=\"themes/zoneBlue/forums/images/darkSilver_31.gif\"><img src=\"images/spacer.gif\" width=\"16\" height=\"1\"></td>\n"
."</tr>\n"
."</table>\n"
."<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
."<tr>\n"
."<td width=\"35\"><IMG SRC=\"themes/zoneBlue/forums/images/darkSilver_34.gif\" WIDTH=\"35\" HEIGHT=\"56\" ALT=\"\"></td>\n"
."<td background=\"themes/zoneBlue/forums/images/darkSilver_35.gif\">&nbsp;</td>\n"
."<td width=\"35\"><IMG SRC=\"themes/zoneBlue/forums/images/darkSilver_38.gif\" WIDTH=\"35\" HEIGHT=\"56\" ALT=\"\"></td>\n"
."</tr>\n"
."</table>\n"
."</td></tr></table>\n";

}

/************************************************************/
/* Function themeindex()                                    */
/*                                                          */
/* This function format the stories on the Homepage         */
/************************************************************/


/************************************************************/
/* Function themeindex()                                    */
/*                                                          */
/* This function format the stories on the Homepage         */
/************************************************************/

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous, $tipath;
    if ($notes != "") {
        $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
        $notes = "";
    }
    if ("$aid" == "$informant") {
        $content = "$thetext$notes\n";
    } else {
        if($informant != "") {
            $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
        } else {
            $content = "$anonymous ";
        }
        $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
    }
    $posted = ""._POSTEDBY." ";
    $posted .= get_author($aid);
    $posted .= " "._ON." $time $timezone ($counter "._READS.")";
    $tmpl_file = "themes/zoneBlue/story_home.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themearticle()                                  */
/*                                                          */
/* This function format the stories on the story page, when */
/* you click on that "Read More..." link in the home        */
/************************************************************/

function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
    global $admin, $sid, $tipath;
    $posted = ""._POSTEDON." $datetime "._BY." ";
    $posted .= get_author($aid);
    if ($notes != "") {
        $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
        $notes = "";
    }
    if ("$aid" == "$informant") {
        $content = "$thetext$notes\n";
    } else {
        if($informant != "") {
            $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
        } else {
            $content = "$anonymous ";
        }
        $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
    }
    $tmpl_file = "themes/zoneBlue/story_page.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themesidebox()                                  */
/*                                                          */
/* Control look of your blocks. Just simple.                */
/************************************************************/

function themesidebox($title, $content) {

    $tmpl_file = "themes/zoneBlue/blocks.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

?>