<?php
/* Nulled by Wizzywig */
/***********تعريب***********/
/**          saher        **/
/**  منتديات شباب وصبايا  **/
/**   www.shababtop.com   **/
/**  saher1986@live.com   **/
/***************************/
// ############################ INITILIZATION ############################
$type = $_GET['type'];
if ($type != "css" && $type != "js")
	exit;

// ########################## INCLUDE BACK-END ###########################
include_once ('config.php');
include_once (dirname(__FILE__).'/includes/data_core.php');

// ############################ OPTIMIZATION #############################
/*$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
if (phpversion() >= '4.0.4pl1' && (strstr($useragent,'compatible') || strstr($useragent,'Gecko'))) {
	if (extension_loaded('zlib')) {
		ob_start('ob_gzhandler');
	}
}*/

// ########################### EXIT CONDITIONS ###########################
// Exit if not logged in
if (empty($userid)) {
	exit;
}

// Exit if banned
if (in_array($_SERVER['REMOTE_ADDR'], $banlist) || in_array($userid, $banlist)) {
	exit;
}

// Exit if IE6
if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.') !== FALSE)) {
	exit;
}

// ############################## START CSS ##############################
if ($_GET['type'] == "css") {

	header ("Content-type: text/css; charset: UTF-8");
	header('Expires: '.gmdate("D, d M Y H:i:s", time() + 3600*24*365).' GMT');

	// Include the css file
	include_once (dirname(__FILE__).'/themes/'.$theme.'/css/style.css');
	exit;
	
}

// ############################## START JS ###############################
if ($_GET['type'] == "js") {

	header('Content-type: text/javascript; charset: UTF-8');
	header("Cache-Control: no-cache, must-revalidate");
	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
	
	// Mark user as no longer idle on load
	if ($status == "away") {
		$sql = "UPDATE arrowchat_status SET status='available' WHERE userid = '".mysql_real_escape_string($userid)."'";
		mysql_query($sql);
		$status = "available";
	}

	for ($i=0;$i<count($language);$i++) {
		$settings .= "g[".$i."] = \"".$language[$i]."\";";
	}
	for ($i=0;$i<count($trayicon);$i++) {
		$settings .= "t[".$i."] = ['".implode("','",$trayicon[$i])."'];";
	}
	for ($i=0;$i<count($apps);$i++) {
		$settings .= "p[".$i."] = ['".implode("','",$apps[$i])."'];";
	}
	for ($i=0;$i<count($unfocus_chat)-1;$i++) {
		$settings .= "C[".$i."] = \"".$unfocus_chat[$i]."\";";
	}
		$settings .= "var T=0,";
		$settings .= "Ta=".$auto_popup_chatbox.",";
		$settings .= "x=\"".$theme."\",";
		$settings .= "E=3E3,";
		$settings .= "ia=\"".getLoggedInUser($userid)."\",";
		$settings .= "q=".$userid.",";
		$settings .= "bb=".$hide_bar.",";
		$settings .= "ta=".$window_open.",";
		$settings .= "da=".$play_sound.",";
		$settings .= "na=\"".$status."\",";
		$settings .= "Ra=".$only_names.",";
		$settings .= "Wa=\"".$hash_id."\",";
		$settings .= "J=".$focus_chat.",";
		$settings .= "Za=".$chatrooms_on.",";
		$settings .= "ua=".$notifications_on.",";
		$settings .= "Lpt=".$disable_long_polling.",";
		$settings .= "Ya=".$hide_bar_on.",";
		$settings .= "\$a=".$applications_on.",";
		$settings .= "Qa=".$popout_chat_on.",";
		$settings .= "k=\"".$base_url."\",";	
		$settings .= "achan=\"".$channel_name."\",";	
		$settings .= "olf=0,";
	
	// Get Template Files
	$file_bar_hide_tab 					= line_break_replace(get_include_contents("themes/".$theme."/template/bar_hide_tab.php")); 
	$file_bar_show_tab 					= line_break_replace(get_include_contents("themes/".$theme."/template/bar_show_tab.php")); 
	$file_applications_bookmarks_tab	= line_break_replace(get_include_contents("themes/".$theme."/template/applications_bookmarks_tab.php"));
	$file_applications_bookmarks_window	= line_break_replace(get_include_contents("themes/".$theme."/template/applications_bookmarks_window.php"));
	$file_applications_bookmarks_list	= line_break_replace(get_include_contents("themes/".$theme."/template/applications_bookmarks_list.php"));
	$file_applications_tab				= line_break_replace(get_include_contents("themes/".$theme."/template/applications_tab.php"));
	$file_applications_window			= line_break_replace(get_include_contents("themes/".$theme."/template/applications_window.php"));
	$file_notifications_tab				= line_break_replace(get_include_contents("themes/".$theme."/template/notifications_tab.php"));
	$file_notifications_window			= line_break_replace(get_include_contents("themes/".$theme."/template/notifications_window.php"));
	$file_chat_tab						= line_break_replace(get_include_contents("themes/".$theme."/template/chat_tab.php"));
	$file_chat_window					= line_break_replace(get_include_contents("themes/".$theme."/template/chat_window.php"));
	$file_buddylist_tab					= line_break_replace(get_include_contents("themes/".$theme."/template/buddylist_tab.php"));
	$file_buddylist_window				= line_break_replace(get_include_contents("themes/".$theme."/template/buddylist_window.php"));
		
	// Include Javascript files
	include_once (dirname(__FILE__).'/includes/js/arrowchat_libraries.js');
	echo "\n\n";
	include_once (dirname(__FILE__).'/includes/js/arrowchat_core.js');	
	exit;
	
}

function line_break_replace($string) {
	return trim(preg_replace("/\s+/", " ", $string));
}

function get_include_contents($filename) {
	$contents = file_get_contents($filename, true);
    return $contents;
}

?>