<?php
!function_exists('readover') && exit('Forbidden');

$cskindb = array();
if ($winduid && is_numeric($skin)) {
	$cskindb = $db->get_one('SELECT sid,name,stylepath,tplpath,yeyestyle,bgcolor,linkcolor,tablecolor,tdcolor,tablewidth,mtablewidth,headcolor,headborder,headfontone,headfonttwo,cbgcolor,cbgborder,cbgfont,forumcolorone,forumcolortwo FROM pw_styles WHERE sid='.pwEscape($skin).'AND uid='.pwEscape($winduid));
}
if ($cskindb) {
	$skin = $cskindb['name'];
	$db_showcss = 0;
	$cskindb['bgcolor'] = str_replace('&#41;',')',$cskindb['bgcolor']);
	extract($cskindb);
	unset($cskindb);
} else {
	if (strpos($skin,'..')===false && file_exists(D_P."data/style/$skin.php") && $db_styledb[$skin][1]==='1') {
		@include Pcv(D_P."data/style/$skin.php");
	} elseif (strpos($db_defaultstyle,'..')===false && file_exists(D_P."data/style/$db_defaultstyle.php")) {
		@include Pcv(D_P."data/style/$db_defaultstyle.php");
	} else {
		@include(D_P."data/style/wind.php");
	}
}
if ($db_mode == 'area') {
	$catedbs = array();
	include_once(D_P.'data/bbscache/catedbs_area_cache.php');
}

if ($db_toolbar && $winduid) {
	include_once(D_P.'data/bbscache/forumlist_cache.php');
}

if ($groupid != 'guest') {
	require_once(R_P.'require/showimg.php');
	list($faceurl) = showfacedesign($winddb['icon'],1,'s');
	$lastlodate = get_date($winddb['lastvisit'],'Y-m-d');
} else {
	if ($db_question) {
		list(,$qcheck) = explode("\t",$db_qcheck);
		if ($qcheck) {
			$qkey = array_rand($db_question);
		}
	}
	$arr_logintype = array();
	if ($db_logintype) {
		for ($i = 0; $i < 3; $i++) {
			if ($db_logintype & pow(2,$i)) {
				$arr_logintype[] = $i;
			}
		}
	} else {
		$arr_logintype[0] = 0;
	}
}

//pw7.0
if (!in_array(SCR,array('register','login'))) {
	$myshortcut = true;
	$shortcutforum = array();
	if (trim($winddb['shortcut'],',')) {
		isset($forum) || require(D_P.'data/bbscache/forum_cache.php');
		foreach (explode(',',$winddb['shortcut']) as $key => $value) {
			if ($value && isset($forum[$value])) {
				$shortcutforum[$value] = $forum[$value]['name'];
			}
		}
	}
	if (empty($shortcutforum)) {
		if (!$db_shortcutforum && $winduid) {
			require_once(R_P.'require/updateforum.php');
			$db_shortcutforum = updateshortcut();
		}
		$shortcutforum = $db_shortcutforum;
		$myshortcut = false;
	}
}

$msgsound = $head_pop = $menu_down = '';
if ($groupid == 'guest' && $db_regpopup == '1') {
	$head_pop = 'head_pop';
} elseif ($winddb['newpm']>0 && $db_msgsound && $secondurl!='message.php' && $_G['maxmsg']>0) {
	$msgsound = "<bgsound src=\"$imgpath/$stylepath/msg.wav\" border=\"0\">";
}
$db_menuinit = "'td_hack' : 'menu_hack'";

if ($winduid) {
	$db_menuinit .= ",'td_u' : 'menu_u'";
}
if ($db_menu%2 == 1) {
	$db_menuinit .= ",'td_sort' : 'menu_sort'";
	$menu_down = "class=\"drop-item\"";
}
if ($db_union) {
	$db_union = explode("\t",stripslashes($db_union));
	$db_union[0] && $db_hackdb = array_merge((array)$db_hackdb,(array)unserialize($db_union[0]));
}


$db_skindb = array();
empty($db_styledb) && $db_styledb['wind'] = array('0' => 'wind','1' => '1');
foreach ($db_styledb as $key => $value) {
	$cname = $value[0] ? $value[0] : $key;
	$value[1] === '1' && $db_skindb[$key] = $cname;
}

$s_url = $pwServer['PHP_SELF'].'?';
foreach ($_GET as $key => $value) {
	$key!='skinco' && $value && $s_url .= "$key=".rawurlencode($value).'&';
}
$s_url = Char_cv($s_url);

if (file_exists(D_P."data/style/{$tplpath}_css.htm")) {
	$css_path = D_P."data/style/{$tplpath}_css.htm";
} else {
	$css_path = D_P.'data/style/wind_css.htm';
}

if (SCR=='index' || $SCR == 'm_home') {
	$key = empty($db_mode) ? ($defaultMode == 'bbs' ? 'home' : 'bbs') : (($defaultMode == $db_mode) ? 'home' : $db_mode);
	${'pwNavCurStyle_'.$key} = 'class="current"';
}

if (!defined('MSG') && defined('M_P') && in_array(SCR,array('index','cate','mode','thread','read'))) {
	$pwModeCss = $pwModeImg.'/style.css';
} else {
	$pwModeCss = '';
}

require PrintEot('header');

?>