<?
/* Nulled by Wizzywig */
/***********تعريب***********/
/**          saher        **/
/**  منتديات شباب وصبايا  **/
/**   www.shababtop.com   **/
/**  saher1986@live.com   **/
/***************************/		
	function update_config_file() {
	
		$file = '<? ';
	
		$sql = "SELECT * FROM arrowchat_config";
		$result = mysql_query($sql);
		
		if ($result) {
			
			while ($row = mysql_fetch_array($result)) {
			
				$file .= '$'.$row[config_name].'="'.$row[config_value].'";';
			
			}
			
		}
		
		$sql = "SELECT * FROM arrowchat_smilies";
		$result = mysql_query($sql);
		
		$file .= ' $smileys = array(';
		
		if ($result) {
		
			while ($row = mysql_fetch_array($result)) {
			
				$file .= '"'.$row[code].'" => "'.$row[name].'",';
			
			}
		
		}
		
		$file .= ');';
		
		$sql = "SELECT * FROM arrowchat_banlist";
		$result = mysql_query($sql);
		
		$file .= ' $banlist = array(';
		
		if ($result) {
		
			while ($row = mysql_fetch_array($result)) {
			
				if (!empty($row['ban_userid']))
					$file .= '"'.$row[ban_userid].'",';
				else
					$file .= '"'.$row[ban_ip].'",';
			
			}
		
		}
		
		$file .= ');';
		
		$file .= '$trayicon = array();$plugins = array();$apps = array();';
		
		$sql = "SELECT * FROM arrowchat_applications WHERE active='1'";
		$result = mysql_query($sql);
		
		if ($result) {
		
			while ($row = mysql_fetch_array($result)) {
			
				$file .= '$apps[]=array("'.$row[id].'","'.$row[name].'","'.$row[folder].'","'.$row[icon].'","'.$row[width].'","'.$row[height].'","'.$row[link].'");';
			
			}
		
		}
		
		$sql = "SELECT * FROM arrowchat_trayicons WHERE active='1' ORDER BY tray_location ASC";
		$result = mysql_query($sql);
		
		if ($result) {
		
			while ($row = mysql_fetch_array($result)) {
			
				$file .= '$trayicon[]=array("'.$row[icon].'","'.$row[name].'","'.$row[location].'","'.$row[target].'","'.$row[width].'","'.$row[height].'","'.$row[tray_width].'","'.$row[tray_name].'");';
			
			}
		
		}
		
		$file .= ' ?>';
		
		$myFile = dirname(dirname(dirname(__FILE__)))."/cache/data_admin_options.php";
		$fh = fopen($myFile, 'w') or die("Cant open cache file.  Is it writable?");
		fwrite($fh, $file);
		fclose($fh);
	}
	
?>