<?

error_reporting (E_ALL ^ E_NOTICE);


// read the database settings from the file
include_once('./settings.php');

// DB Connection Info read from settings file
Global $DBServer, $DBUser, $DBPass, $DBDatabase;
			
//establish a connection to database (server, database, password)
mysql_connect($DBServer, $DBUser, $DBPass) or die ("Could not connect to database");
	
//select database
mysql_select_db($DBDatabase) or die ("Could not select database");


$Settings['DBPrefix'] = $DBPrefix;


	$query = "select * from `".$Settings['DBPrefix']."core-Settings`";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result)) {
		$Settings[$row['Name']] = $row['Value'];
	}


// remove slashes from language id to avoid any possible attempts to load other code in
$Settings['DefaultLanguage'] = str_replace('/','',$Settings['DefaultLanguage']);

if ($Settings['DefaultLanguage'] == '') {
	$Settings['DefaultLanguage'] = 'english';
}

// see if the file exists
if (file_exists('./languages/inc-core-lang-'.$Settings['DefaultLanguage'].'.php')) {
	$LanguageFileLocated = true;
}
else {
	$Settings['DefaultLanguage'] = 'english';
	// check again for default file
	if (file_exists('./languages/inc-core-lang-'.$Settings['DefaultLanguage'].'.php')) {
		$LanguageFileLocated = true;
	}
	else {
		print 'Error.  Language files could not be loaded.<br><br>Please ensure at least the English FlexCMS language pack is present in the <i>languages</i> folder under the main FlexCMS directory.';
	}
}

if ($LanguageFileLocated == true) {
	include_once('./languages/inc-core-lang-'.$Settings['DefaultLanguage'].'.php');
}


$MainURL = $Settings['BaseURL'].'/'.$Settings['ScriptName'];

$FontFace = 'Arial';
$FontSize = 2;

if (function_exists("gd_info")) {
	$GDInfo = @gd_info();
}
if ($GDInfo['GIF Create Support'] == true) {
	$MsgText[0][314] = $MsgText[0][537];
}
else {
	$JPEGPNGOnly = '<br>('.$MsgText[0][313].')';
}

	
	$QS = $HTTP_SERVER_VARS['REQUEST_URI'];

	list ($LocationPath, $QSData) = explode('?', $QS, 2);


	if (substr($QSData,strlen($QSData)-3,3) == '/bw') {
		$BWPart = 'BW';
	}
	if (substr($QSData,strlen($QSData)-4,4) == '/bw2') {
		$BWPart = 'BW2';
	}


	
	print '<html><head>
<title>Upload New Image</title>
<meta name="Description" content="">
<meta name="Keywords" content="">
<meta name="Author" content="DCSun Internet Technologies">
<meta name="Generator" content="DCSun PageBuilder">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
</head>
<body bgcolor="#eeeeee" text="#000000" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" rightmargin="0" style="margin:0">

	<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%" valign="middle">

	<form name="ImageForm" action="inc-core-admin-editor-imageupload-submit.php" method="post" enctype="multipart/form-data"><input type="hidden" name="BW" value="'.$BWPart.'">

<div align="center"><br><table width="500" border="0" cellpadding="3" cellspacing="3">

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[0][310].':</b></td><td><input type="file" name="FileData" style="'.$FormStyle.'"><br><font face="'.$FontFace.'" size="'.($FontSize-1).'">('.$MsgText[0][311].': '.number_format($Settings['MaxImageFileSize'],0,'','').' KBytes)</td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[0][312].':'.$JPEGPNGOnly.'</b></td><td><font face="'.$FontFace.'" size="'.$FontSize.'">	<input type="radio" name="ImageResize" value="None" checked> '.$MsgText[0][314].'<br>
	<input type="radio" name="ImageResize" value="ResizeDimensions"> '.$MsgText[0][315].' <input type="text" name="ResizeMaxWidth" size="3"> '.$MsgText[0][316].' <input type="text" name="ResizeMaxHeight" size="3"> ('.$MsgText[0][317].')<br>
	<input type="radio" name="ImageResize" value="ScalePercent"> '.$MsgText[0][318].' <input type="text" name="ResizePercent" size="3">%<br>
</td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[0][319].':</b></td><td><font face="'.$FontFace.'" size="'.$FontSize.'">	<input type="radio" name="NewName" value="Previous" checked> '.$MsgText[0][320].'<br>
	<input type="radio" name="NewName" value="Random"> '.$MsgText[0][321].'<br>
	<input type="radio" name="NewName" value="Enter"> '.$MsgText[0][322].': <input type="text" name="NewNameEnter" size="30"><br>
</td></tr>

<tr><td colspan="2"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[0][323].'</b></td></tr>
</table><br><input type="hidden" name="MAX_FILE_SIZE" value="'.number_format(($Settings['MaxImageFileSize']*1024),0,'','').'"><div align="center"><input name="SubmitButton" type="submit" value="'.$MsgText[0][324].'" style="'.$FormStyle.'"></div></form>
	
	</td>
</tr></table></div>

</body></html>';
	

?>
