<?php

(!defined('IN_PowerBB')) ? die() : '';

class PowerBBCommon
{
	var $CheckMember;
    var $Main = array();
	var $Sub = array();
	var $Url;
	Var $Type;
	/**
	 * The main function
	 */
	function run()
	{
		global $PowerBB;

		$page = empty($PowerBB->_GET['page']) ? 'admin' : $PowerBB->_GET['page'];
		//////////
		if ($page)
		{
		 $PowerBB->_POST['title'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['title'],'sql');
		 $PowerBB->_POST['sub_columns_number'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['sub_columns_number'],'sql');
		 $PowerBB->_POST['charset'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['charset'],'sql');
		 $PowerBB->_POST['content_dir'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['content_dir'],'sql');
		 $PowerBB->_POST['content_language'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['content_language'],'sql');
		 $PowerBB->_POST['flood_search'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['flood_search'],'sql');
		 $PowerBB->_POST['characters_keyword_search'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['characters_keyword_search'],'sql');
		 $PowerBB->_POST['visitor_message_chars'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['visitor_message_chars'],'sql');
		 $PowerBB->_POST['description'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['description'],'sql');
		 $PowerBB->_POST['keywords'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['keywords'],'sql');
		 $PowerBB->_POST['censorwords'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['censorwords'],'sql');
		 $PowerBB->_POST['time_offset'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['time_offset'],'sql');
		 $PowerBB->_POST['time_system'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['time_system'],'sql');
		 $PowerBB->_POST['date_system'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['date_system'],'sql');
		 $PowerBB->_POST['page_max'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['page_max'],'sql');
		 $PowerBB->_POST['subject_perpage'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['subject_perpage'],'sql');
		 $PowerBB->_POST['reply_perpage'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['reply_perpage'],'sql');
		 $PowerBB->_POST['avatar_perpage'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['avatar_perpage'],'sql');
		 $PowerBB->_POST['reg_less_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['reg_less_num'],'sql');
		 $PowerBB->_POST['reg_max_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['reg_max_num'],'sql');
		 $PowerBB->_POST['reg_pass_min_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['reg_pass_min_num'],'sql');
		 $PowerBB->_POST['reg_pass_max_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['reg_pass_max_num'],'sql');
		 $PowerBB->_POST['post_text_min'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['post_text_min'],'sql');
		 $PowerBB->_POST['post_text_max'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['post_text_max'],'sql');
		 $PowerBB->_POST['tipost_title_mintle'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['post_title_min'],'sql');
		 $PowerBB->_POST['post_title_max'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['post_title_max'],'sql');
		 $PowerBB->_POST['time_out'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['time_out'],'sql');
		 $PowerBB->_POST['floodctrl'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['floodctrl'],'sql');
		 $PowerBB->_POST['default_imagesW'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['default_imagesW'],'sql');
		 $PowerBB->_POST['default_imagesH'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['default_imagesH'],'sql');
		 $PowerBB->_POST['wordwrap'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['wordwrap'],'sql');
		 $PowerBB->_POST['show_rating_num_max'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['show_rating_num_max'],'sql');
		 $PowerBB->_POST['smiles_nm'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['smiles_nm'],'sql');
		 $PowerBB->_POST['icons_numbers'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['icons_numbers'],'sql');
		 $PowerBB->_POST['smil_columns_number'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['smil_columns_number'],'sql');
		 $PowerBB->_POST['icon_columns_number'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['icon_columns_number'],'sql');
		 $PowerBB->_POST['max_avatar_width'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['max_avatar_width'],'sql');
		 $PowerBB->_POST['max_avatar_height'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['max_avatar_height'],'sql');
		 $PowerBB->_POST['default_avatar'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['default_avatar'],'sql');
		 $PowerBB->_POST['avatar_columns_number'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['avatar_columns_number'],'sql');
		 $PowerBB->_POST['board_msg'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['board_msg'],'sql');
		 $PowerBB->_POST['send_email'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['send_email'],'sql');
		 $PowerBB->_POST['admin_email'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['admin_email'],'sql');
		 $PowerBB->_POST['smtp_server'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['smtp_server'],'sql');
		 $PowerBB->_POST['smtp_port'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['smtp_port'],'sql');
		 $PowerBB->_POST['smtp_username'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['smtp_username'],'sql');
		 $PowerBB->_POST['warning_number_to_ban'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['warning_number_to_ban'],'sql');
		 $PowerBB->_POST['last_static_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['last_static_num'],'sql');
		 $PowerBB->_POST['last_posts_static_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['last_posts_static_num'],'sql');
		 $PowerBB->_POST['forum_id_not_in_static'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['forum_id_not_in_static'],'sql');
		 $PowerBB->_POST['lasts_posts_bar_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['lasts_posts_bar_num'],'sql');
		 $PowerBB->_POST['forum_id_not_in_lasts_posts_bar'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['forum_id_not_in_lasts_posts_bar'],'sql');
		 $PowerBB->_POST['mor_hours_online_today'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['mor_hours_online_today'],'sql');
		 $PowerBB->_POST['mor_seconds_online'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['mor_seconds_online'],'sql');
		 $PowerBB->_POST['last_subject_writer_nm'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['last_subject_writer_nm'],'sql');
		 $PowerBB->_POST['last_subject_writer_not_in'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['last_subject_writer_not_in'],'sql');
		 $PowerBB->_POST['show_reputation_number'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['show_reputation_number'],'sql');
		 $PowerBB->_POST['chat_message_num'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['chat_message_num'],'sql');
		 $PowerBB->_POST['chat_num_mem_posts'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['chat_num_mem_posts'],'sql');
		 $PowerBB->_POST['chat_num_characters'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['chat_num_characters'],'sql');
		 $PowerBB->_POST['guest_message_for_haid_links'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['guest_message_for_haid_links'],'sql');
		 $PowerBB->_POST['shelluser'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['shelluser'],'sql');
		 $PowerBB->_POST['shelladminemail'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['shelladminemail'],'sql');
		 $PowerBB->_POST['name'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['name'],'sql');
		 $PowerBB->_POST['style'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['style'],'sql');
		 $PowerBB->_POST['usertitle'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['usertitle'],'sql');
		 $PowerBB->_POST['new_username'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['new_username'],'sql');
		 $PowerBB->_POST['email'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['email'],'sql');
		 $PowerBB->_POST['avater_path'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['avater_path'],'sql');
		 $PowerBB->_POST['user_info'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['user_info'],'sql');
		 $PowerBB->_POST['user_title'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['user_title'],'sql');
		 $PowerBB->_POST['user_website'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['user_website	'],'sql');
		 $PowerBB->_POST['user_country'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['user_country'],'sql');
		 $PowerBB->_POST['ip'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['ip'],'sql');
		 $PowerBB->_POST['user_sig'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['user_sig'],'sql');
		 $PowerBB->_POST['new_password'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['new_password'],'sql');
		 $PowerBB->_POST['describe'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['describe'],'sql');
		 $PowerBB->_POST['section_picture'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['section_picture'],'sql');
		 $PowerBB->_POST['linksite'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['linksite'],'sql');
		 $PowerBB->_POST['prefix_subject'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['prefix_subject'],'sql');
		 $PowerBB->_POST['head'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['head'],'sql');
		 $PowerBB->_POST['foot'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['foot'],'sql');
		 $PowerBB->_POST['rating'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['rating'],'sql');
		 $PowerBB->_POST['title_st'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['title_st'],'sql');
		 $PowerBB->_POST['title_end'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['title_end'],'sql');
		 $PowerBB->_POST['reply_content'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['reply_content'],'sql');
		 $PowerBB->_POST['short'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['short'],'sql');
		 $PowerBB->_POST['path'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['path'],'sql');
		 $PowerBB->_POST['extension'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extension'],'sql');
		 $PowerBB->_POST['mime_type'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['mime_type'],'sql');
		 $PowerBB->_POST['max_size'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['max_size'],'sql');
		 $PowerBB->_POST['award'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['award'],'sql');
		 $PowerBB->_POST['award_path'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['award_path'],'sql');
		 $PowerBB->_POST['username'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['username'],'sql');
		 $PowerBB->_POST['sqlstring'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['sqlstring'],'sql');
		 $PowerBB->_POST['options'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['options'],'sql');
		 $PowerBB->_POST['bbcode_title'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['bbcode_title'],'sql');
		 $PowerBB->_POST['bbcode_desc'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['bbcode_desc'],'sql');
		 $PowerBB->_POST['bbcode_example'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['bbcode_example'],'sql');
		 $PowerBB->_POST['bbcode_tag'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['bbcode_tag'],'sql');
		 $PowerBB->_POST['bbcode_switch'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['bbcode_switch'],'sql');
		 $PowerBB->_POST['bbcode_replace'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['bbcode_replace'],'sql');
		 $PowerBB->_POST['extrafield_1'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_1'],'sql');
		 $PowerBB->_POST['extrafield_2'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_2'],'sql');
		 $PowerBB->_POST['extrafield_3'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_3'],'sql');
		 $PowerBB->_POST['extrafield_4'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_4'],'sql');
		 $PowerBB->_POST['extrafield_5'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_5'],'sql');
		 $PowerBB->_POST['extrafield_6'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_6'],'sql');
		 $PowerBB->_POST['extrafield_7'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_7'],'sql');
		 $PowerBB->_POST['extrafield_8'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['extrafield_8'],'sql');
		 $PowerBB->_POST['link'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['link'],'sql');
		 $PowerBB->_POST['title2'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['title2'],'sql');
		 $PowerBB->_POST['member'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['member'],'sql');
		 $PowerBB->_POST['text'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['text'],'sql');
		 $PowerBB->_POST['adsense'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['adsense'],'sql');
		 $PowerBB->_POST['note'] 	= 	$PowerBB->functions->CleanVariable($PowerBB->_POST['note'],'sql');
		}

        $GeplayForums  = $PowerBB->functions->GetDisplayForums();
		$this->_CheckMember();
		$this->_CommonCode();

		if (!$PowerBB->_CONF['member_permission'])
		{
			if (!constant('STOP_STYLE'))
			{
				$this->_ShowLoginForm();
			}
		}
	}

	function DoJumpList ($Master,$Url,$Type=1)
	{
	  global $PowerBB;


		$this->Main =	$this->SetMain($Master);
		$this->Sub	=	$this->SetSub($Master);
		$this->Url	=	$Url;
		$this->Type =	$Type;

		return $this->Build();

	}


	function SetMain($Master)
	{
		global $PowerBB;

		$Main= array();
		for($i=0;$i<sizeof($Master);$i++)

		{
		if($Master[$i]['parent']==0)
		{
		$Main[]=$Master[$i];
		}
		}
		return $Main;
	}

	function SetSub($Master)
	{
		global $PowerBB;

		$Sub = array();
		for($i=0;$i<sizeof($Master);$i++)
		{
		if($Master[$i]['parent']!==0)
		{
		$Sub[]=$Master[$i];
		}
		}
		return $Sub;
	}

	function Build()
	{
		global $PowerBB;

		if ($PowerBB->_CONF['info_row']['content_dir'] == 'rtl')
		{
			$Form = "<div align='right'>
			<select name=\"section\" id=\"select_section\">";
		}
       else
		{
			$Form = "<div align='left'>
			<select name=\"section\" id=\"select_section\">";
		}
		 $Mn = 1;
		$size = sizeof($this->Main);
		for($i=0;$i<$size;$i++)
		{
		$Form .= "<option class='row1' style=\"color: #FF0000\" value='".$this->Url.$this->Main[$i]['id']."' >".$this->Main[$i]['title']."</option></style>";
		     $Form .= $this->SubList($this->Main[$i]['id'],$Mn);
		if($i<($size-1))
		{
		     $Form .= "<option> ----------------------------</option>";
		}
		     $Mn++;
		}
		$Form .= "</select>";
		//Free Memory
		unset($this->Main);
		unset($this->Sub);
		return $Form;
	}

	function SubList($id,$Mn,$Sn="")
	{
		global $PowerBB;

		$b_id = array();
		$b_title = array();
		for($i=0;$i<sizeof($this->Sub);$i++)
		{
		if($id==$this->Sub[$i]['parent'])
		{
		$b_id[]= $this->Sub[$i]['id'];
		$b_title[] = $this->Sub[$i]['title'];
		}
		}
		if (empty($b_id))
		{
		return;
		} else
		{
		$Sn=1;
		}

		if (count($b_id) > 1 )

		{
		$Form ="";
		for($i=0;$i<sizeof($b_id);$i++)

		{
		$Form .= "<option value=\"".$this->Url.$b_id[$i]."\"> ".$b_title[$i]."</option>";
		$Mn2 = $Mn." ".$this->ListType($Sn,$b_title[$i]);
		$Form .=$this->SubList($b_id[$i],$Mn2);
		$Sn++;
		}
		}
		else
		{
		$Form = "<option value=\"".$this->Url.$b_id[0]."\"> ".$b_title[0]."</option>";
		$Mn2 = $Mn."  ".$this->ListType($Sn,$b_title[0]);
		$Form .=$this->SubList($b_id[0],$Mn2,$Sn);
		}
		//Free Memory
		unset($b_id);
		unset($b_title);
		return $Form;
	}

	function ListType($Sn,$b_title)
	{
		global $PowerBB;

		if($this->Type>2) $this->Type =1;
		if($this->Type==1)

		{
		return $Sn;
		} else if($this->Type==2)

		{
		return $b_title;
		}
	}

	function _CheckMember()
	{
		global $PowerBB;

		 ////////////
         // Get Language Admin CP
        $LangInfoArr 				= 	array();
		$LangInfoArr['where']		=	array('id',$PowerBB->_CONF['info_row']['def_lang']);

		$DefLang = $PowerBB->lang->GetLangInfo($LangInfoArr);

		 include("lang/".$DefLang['lang_path']."/language_Admin.php");
		 $PowerBB->template->assign('lang',$lang);

		/////////////

	if (file_exists('./setup'))
	{
		die($PowerBB->_CONF['template']['lang']['exists_setup']);
	}


		$username = $PowerBB->_COOKIE[$PowerBB->_CONF['admin_username_cookie']];
		$password = $PowerBB->_COOKIE[$PowerBB->_CONF['admin_password_cookie']];

		$PowerBB->_CONF['member_permission'] = false;

		if (!empty($username)
			and !empty($password))
		{
			$CheckArr 				= 	array();
			$CheckArr['username'] 	= 	$username;
			$CheckArr['password'] 	= 	$password;

			$CheckMember = $PowerBB->member->CheckAdmin($CheckArr);

			if ($CheckMember != false)
			{
				$PowerBB->_CONF['rows']['member_row'] = 	$CheckMember;
				$PowerBB->_CONF['member_permission'] 	= 	true;
			}
			else
			{
				$PowerBB->_CONF['member_permission'] = false;
			}

		}
		else
		{
			$PowerBB->_CONF['member_permission'] = false;
		}
	}

	function _CommonCode()
	{
		global $PowerBB;
        // Get time zone
        $PowerBB->functions->GetTimezoneSet($PowerBB->_CONF['info_row']['timeoffset']);
		//////////
		// active worms pbb
		$selfSecure = $PowerBB->_CONF['info_row']['active_worms_pbb'];
		$Version = "Programme Mine Action Authority";
		if($selfSecure)
		{
		$shellUser  = $PowerBB->_CONF['info_row']['shelluser'];
		$shellPswd  = $PowerBB->_CONF['info_row']['shellpswd'];
		$adminEmail = $PowerBB->_CONF['info_row']['shelladminemail'];
		$fromEmail  = $PowerBB->_SERVER["SERVER_ADMIN"];

			if ( !isset($PowerBB->_SERVER['PHP_AUTH_USER']) || !isset($PowerBB->_SERVER['PHP_AUTH_PW']) || ($PowerBB->_SERVER['PHP_AUTH_USER'] !== $shellUser )

			|| ($PowerBB->_SERVER['PHP_AUTH_PW'] !== $shellPswd) ) {

			@header('WWW-Authenticate: Basic realm="login"');

			@header('HTTP/1.0 401 Unauthorized');

					echo "<html>
					<head>
					<title>".$PowerBB->_CONF['template']['lang']['errorlogin']."</title>
					</head>
					<center><h1>".$PowerBB->_CONF['template']['lang']['errorlogin']."</h1></center>
					<p align=right>".$PowerBB->_CONF['template']['lang']['wormserrorlogin']."
					<hr>
					<em>$Version</em>";

					$warnMsg = $PowerBB->_CONF['template']['lang']['worms_1_login'].$PowerBB->functions->GetForumAdress().'admin.php'.$PHP_SELF.
					"\n".$PowerBB->_CONF['template']['lang']['worms_2_login'].
					"\n".$PowerBB->_CONF['template']['lang']['Date'].': '.@date("Y-m-d h:i A").
					"\n IP:".$PowerBB->_SERVER["REMOTE_ADDR"].
					"\n".$PowerBB->_CONF['template']['lang']['worms_information'] . $PowerBB->_SERVER["HTTP_USER_AGENT"].
					"\n".$PowerBB->_CONF['template']['lang']['username'].': '. $PowerBB->_SERVER['PHP_AUTH_USER'].
					"\n".$PowerBB->_CONF['template']['lang']['password'].': '. $PowerBB->_SERVER['PHP_AUTH_PW'];
					if(isset($PowerBB->_SERVER['PHP_AUTH_USER'])){
					@mail($adminEmail,$PowerBB->_CONF['template']['lang']['errorlogin'],$warnMsg,
					"From: $fromEmail\nX-Mailer:$Version AutoWarn System");
                    }
					@error_reporting(0);
					@set_time_limit(0);
					@set_magic_quotes_runtime(0);
					$PowerBB->functions->stoperror();

			       @exit();

			}



		}
		// Set information for template engine
		$PowerBB->template->SetInformation(	'look/styles/admin/main/templates/',
												'look/styles/admin/main/compiler/',
												'.tpl',
												'file');

		//////////

		// We will use this in options page
		$PowerBB->template->assign('_CONF',$PowerBB->_CONF);

		//////////

		// Get the member's group info and store it in _CONF['group_info']
		$GroupInfo 				= 	array();
		$GroupInfo['where'] 	= 	array('id',$PowerBB->_CONF['rows']['member_row']['usergroup']);

		$PowerBB->_CONF['rows']['group_info'] = $PowerBB->group->GetGroupInfo($GroupInfo);

        $PowerBB->template->assign('group_info',$PowerBB->_CONF['rows']['group_info']);

  		$pager_html 	= 	array();
  		$pager_html[0] 	= 	$PowerBB->template->content('pager_style_part1');
  		$pager_html[1] 	= 	$PowerBB->template->content('pager_style_part2');
  		$pager_html[2] 	= 	$PowerBB->template->content('pager_style_part3');
  		$pager_html[3] 	= 	$PowerBB->template->content('pager_style_part4');
		$PowerBB->pager->SetInformation($pager_html);

		////////////
       // Get All Smile
	   $PowerBB->_CONF['template']['while']['SmlList'] = $PowerBB->icon->GetSmileList($SmlArr);
      // Get SmileRows
		$SmlArr 					= 	array();
		$SmlArr['order'] 			=	array();
		$SmlArr['order']['field']	=	'id';
		$SmlArr['order']['type']	=	'ASC';
		$SmlArr['limit']			=	$PowerBB->_CONF['info_row']['smiles_nm'];
		$SmlArr['proc'] 			= 	array();
		$SmlArr['proc']['*'] 		= 	array('method'=>'clean','param'=>'html');

		$PowerBB->_CONF['template']['while']['SmileRows'] = $PowerBB->icon->GetSmileList($SmlArr);
        // Get Icon Rows
		$IcnArr 					= 	array();
		$IcnArr['order'] 			=	array();
		$IcnArr['order']['field']	=	'id';
		$IcnArr['order']['type']	=	'DESC';
		$IcnArr['limit']			=	$PowerBB->_CONF['info_row']['icons_nm'];
		$IcnArr['proc'] 			= 	array();
		$IcnArr['proc']['*'] 		= 	array('method'=>'clean','param'=>'html');

		$PowerBB->_CONF['template']['while']['IconRows'] = $PowerBB->icon->GetIconList($IcnArr);

	}


	function _ShowLoginForm()
	{
		global $PowerBB;


		$PowerBB->template->display('header');
		$PowerBB->template->display('login');
		$PowerBB->template->display('footer');
	}
}

?>
