<?php
define( '_UEXEC', 1 ); 
/************************************************************************
	UebiMiau is a GPL'ed software developed by 
	
	 - Aldoir Ventura - aldoir@users.sourceforge.net
	 - http://uebimiau.sourceforge.net
	
	Fell free to contact, send donations or anything to me :-)
	São Paulo - Brasil
	
	**********************************************
	Version 3.2.0 Upgrades and templates developed by
	 
	 - Todd Henderson - Lead Developer
	 - http://tdah.us
	 - Email: todd@tdah.us
	 
	 - Dave Rodgers - Project Consultant
	 - http://www.manvel.net 
	 - Email: Davenmanvel@inbox.com
	
	Feel free to contact us, send donations or anything to me as well...
	
	Special thanks to the developers at telaen.org, codeworxtech.com, tinymce.moxiecode.com
	without help this project wouldn't be possible 

	**********************************************
	- File:			admin/editor.php
	- Developer: 	Todd Henderson / Mods by Laurent (AdNovea)
	- Date:			November 4, 2008
	- version:		(3.2.0) 1.0
	- Description:  Editor engine

*************************************************************************/
// no direct access


 
	require_once('common.php');
		// Redirect to the login page if noone is connected

	 include('filter.php');
		// Redirect to the login page if noone is connected
// Log user if needed
		if ((!isset($_SESSION['validUser'])) || ($_SESSION['validUser'] != true)){
			header("Location: login.php?lid=$lid&tid=$tid");
		}
	$WINDIR = $_SERVER["WINDIR"];
	$uri = $_SERVER["PHP_SELF"];
	$date = date("Ymd");
	$realdate = date("Y.m.d");
	
	preg_match ("/^.*?@(.*)$/",$_SERVER["SERVER_ADMIN"],$domain);
	$curdomain = $domain[1];
	
	$config = array ($admin_edit_config,"../".CFG_CONFIG);
	$languages = array ($admin_edit_langs,"../".CFG_LANGUAGES);
	$themes = array ($admin_edit_themes,"../".CFG_THEMES); 
	$pop3 = array ($admin_edit_pop,"../".CFG_MAIL);
	$chat = array ($admin_edit_chat,"../".CFG_CHAT);
	$calendar = array ($admin_edit_calendar,"../".CFG_CALENDAR);
	$help = array ($admin_edit_help,"../".CFG_HELP);
	$paths = array ($admin_edit_paths,"../".CFG_PATHS);
	$backup = array ($admin_edit_backup,"../".CFG_BACKUP);
	
	$view_backups = array ($admin_edit_view_backups,"../".CFG_VIEWBACKUPS);
	
	$files = array ($admin_filemanager,"../".CFG_Files);
	
	$load=$_GET['load'];
	$message = ${$load}[0];
	$file = ${$load}[1];

	if ( isset($_POST['action']) && ($_POST['action'] == $admin_write2file) ) {
			$feed = stripslashes($_POST['data']);
			$mesg = "$admin_writemods $file";
			$fhw = fopen("$file", "w");
			$ok = fwrite ($fhw,"$feed");
			fclose ($fhw);
	}

	echo DOC_TYPE."
	<html>
	<head>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$default_char_set\">
		<title>$admin_editor $message</title>
		<link href=\"../themes/$selected_theme/css/admin.css\" rel=\"stylesheet\" type=\"text/css\">
		<script type=\"text/javascript\" src=\"../themes/$selected_theme/js/webmail.js\"></script>	   
	</head>
	
	<body >
	
		<center>
		<p class=\"caption\">$message<br></p>
		
		<form name=\"form\" method=\"post\" action=\"{$uri}?load={$load}\">
			<input type=\"hidden\" name=\"lid\" value=\"$lid\">
			<input type=\"hidden\" name=\"tid\" value=\"$tid\">
			<font color=\"#FF0000\">".((isset($mesg)) ? $mesg : $admin_remote_edit)."</font><br>
			<textarea class=\"input\" name=\"data\" id=\"data\"rows=125 cols=155>".file_get_contents($file)."</textarea>
			<br>
			<br>
			<input class=\"button\" type=\"submit\" name=\"action\" value=\"$admin_refresh\">&nbsp;
			<input class=\"button\" type=\"submit\" name=\"action\" value=\"$admin_write2file\">&nbsp;
			<input class=\"button\" type=\"button\" value=\"$bt_back\" onclick=\"javascript:location='index.php?lid=$lid&tid=$tid'\">
		</form>
		</center>
		
	</body>
	</html>";


?>



