__loadedFile = "";
$this->__comboStyles = true;
$this->__controlName = "";
$this->__controlWidth = 0;
$this->__controlHeight = 0;
$this->__initialValue = "";
$this->__initialValueNoBase = "";
$this->__langPack = 0;
$this->__hideCopy = 0;
$this->__hideCut = 0;
$this->__hidePaste = 0;
$this->__hideSave = 0;
$this->__hideSpelling = 0;
$this->__hideRemoveTextFormatting = 0;
$this->__hideFullScreen = 0;
$this->__hideBold = 0;
$this->__hideUnderline = 0;
$this->__hideItalic = 0;
$this->__hideStrikethrough = 0;
$this->__hideNumberList = 0;
$this->__hideBulletList = 0;
$this->__hideDecreaseIndent = 0;
$this->__hideIncreaseIndent = 0;
$this->__hideSuperScript = 0;
$this->__hideSubScript = 0;
$this->__hideLeftAlign = 0;
$this->__hideCenterAlign = 0;
$this->__hideRightAlign = 0;
$this->__hideJustify = 0;
$this->__hideHorizontalRule = 0;
$this->__hideLink = 0;
$this->__hideAnchor = 0;
$this->__hideMailLink = 0;
$this->__hideHelp = 0;
$this->__hideFont = 0;
$this->__hideSize = 0;
$this->__hideFormat = 0;
$this->__hideStyle = 0;
$this->__hideForeColor = 0;
$this->__hideBackColor = 0;
$this->__hideTable = 0;
$this->__hideForm = 0;
$this->__hideImage = 0;
$this->__hideFlash = 0;
$this->__hideFile = 0;
$this->__hideMedia = 0;
$this->__hideCustom = 0;
$this->__flashPath = "";
$this->__mediaPath = "";
$this->__hideTextBox = 0;
$this->__hideSymbols = 0;
$this->__hideProps = 0;
$this->__hideWord = 0;
$this->__hideAbsolute = 0;
$this->__hideClean = 0;
$this->__hideGuidelines = 0;
$this->__hideToolbarMode = 0;
$this->__hidePositionAbsolute = 0;
$this->__disableEditMode = 0;
$this->__disableSourceMode = 0;
$this->__disablePreviewMode = 0;
$this->__guidelinesOnByDefault = 0;
$this->__imagePath = "";
$this->__forcePasteWord = false;
$this->__setCursor = false;
$this->__hasFlashLibraries = false;
$this->__hasAdditionalButtons = false;
$this->__flashLibsArray = array();
$this->__baseHref = "";
$this->__numTopHidden = 0;
$this->__numBottomHidden = 0;
$this->__imagePathType = 0;
$this->__docType = 0;
$this->__imageDisplayType = -1;
$this->__flashDisplayType = 0;
$this->__disableImageUploading = 0;
$this->__disableImageDeleting = 0;
$this->__disableFlashUploading = 0;
$this->__disableFlashDeleting = 0;
$this->__disableMediaUploading = 0;
$this->__disableMediaDeleting = 0;
$this->__disableLinkUploading = 0;
$this->__enableXHTMLSupport = 1;
$this->__useSingleLineReturn = 1;
$this->__customInsertArray = array();
$this->__customLinkArray = array();
$this->__toolbarset = array();
$this->__toolbarsetnames = array();
$this->__hasCustomInserts = false;
$this->__hasCustomLinks = false;
$this->__hasEventListener = false;
$this->__snippetCSS = "";
$this->__textareaRows = 10;
$this->__textareaCols = 30;
$this->__fontNameList = "";
$this->__fontSizeList = "";
$this->__dt = "";
$this->__hideWebImage = 0;
$this->__hideWebFlash = 0;
$this->__hideTagBar = 0;
$this->__language = 0;
$this->__imageLibsArray = array();
$this->__eventListener = array();
$this->__skinName = "default";
$this->__hasImageLibraries = false;
$this->__showLineNumber = 0;
$this->__hideFlashTab = 0;
$this->__hideMediaTab = 0;
$this->__styles = "";
$this->__linkPath = "";
$this->__imageMaxWidth = 0;
$this->__imageMaxHeight = 0;
$this->__toolbarCount = 0;
$this->__maxUploadFileSize = 0;
if (@$_COOKIE["de_mode"]) {
$this->__modeName = $_COOKIE["de_mode"];
} else {
$this->__modeName = "";
}
}
function iepopupstyle()
{
$filePath = $GLOBALS['dname'] . '/skins/' . $this->__skinName . '/ie_popup.css';
$data = '';
if (is_file($filePath)) {
$fp = fopen($filePath, 'rb');
if ($fp) {
while (!feof($fp)) {
$data .= fgets($fp, 1024);
}
fclose($fp);
}
}
$find = '/\n/i';
$replace = "";
$data = preg_replace($find, $replace, $data);
$find = '/\r/i';
$replace = "";
$data = preg_replace($find, $replace, $data);
$find = '/"/i';
$replace = "'";
$data = preg_replace($find, $replace, $data);
$find = '/\t/i';
$replace = "";
$data = preg_replace($find, $replace, $data);
return $data;
}
function AddToolbarButton($ButtonName, $Width = 21, $Height = 20, $src = "", $jsfunc = "", $tb = "")
{
//Add toolbar button
$this->__hasAdditionalButtons = true;
$this->__toolbarbuttons[] = array("Name" => $ButtonName, "Width" => $Width , "Height" => $Height , "ImgSrc" => $src, "JSFunc" => $jsfunc, "Toolbar" => $tb);
}
function AddEventListener($event, $jsfunc = "")
{
// Add javascript event listener for Editor
$this->__hasEventListener = true;
$this->__eventListener[] = array("Name" => $event, "Func" => $jsfunc);
}
function __FormatEventListener()
{
// Private Function - This function will return all of the toolbar buttons as JavaScript arrays
if ($this->__hasEventListener == true) {
$ciText = "[";
for ($i = 0; $i < sizeof($this->__eventListener); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__eventListener[$i]["Name"]));
$func = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__eventListener[$i]["Func"]));
$ciText .= "[\"" . $name . "\", \"" . $func . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
} else {
$ciText = "[]";
}
return $ciText;
}
function __FormatToolbarButtons()
{
// Private Function - This function will return all of the toolbar buttons as JavaScript arrays
if ($this->__hasAdditionalButtons == true) {
$ciText = "[";
for ($i = 0; $i < sizeof($this->__toolbarbuttons); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__toolbarbuttons[$i]["Name"]));
$width = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__toolbarbuttons[$i]["Width"]));
$height = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__toolbarbuttons[$i]["Height"]));
$src = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__toolbarbuttons[$i]["ImgSrc"]));
$jsfunc = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__toolbarbuttons[$i]["JSFunc"]));
$tb = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__toolbarbuttons[$i]["Toolbar"]));
$ciText .= "[\"" . $name . "\", \"" . $width . "\", \"" . $height . "\", \"" . $src . "\", \"" . $jsfunc . "\", \"" . $tb . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
} else {
$ciText = "[]";
}
return $ciText;
}
function SetImageUploadSize($w,$h)
{
$this->__imageMaxWidth = $w;
$this->__imageMaxHeight = $h;
}
function HideTagBar()
{
$this->__hideTagBar = true;
}
function SetMaxUploadFileSize($s)
{
$this->__maxUploadFileSize = $s;
}
function SetFocus()
{
$this->__setCursor = true;
}
function HideMediaTab()
{
$this->__hideMediaTab = true;
}
function HideFlashTab()
{
$this->__hideFlashTab = true;
}
function ShowLineNumber()
{
$this->__showLineNumber = true;
}
function AddToolbar($toolbarname, $list)
{
$this->__toolbarset[$toolbarname] = $list;
$this->__toolbarsetnames[] = $toolbarname;
}
function ForcePasteWord()
{
$this->__forcePasteWord = true;
}
function SetLinkPath($p)
{
$this->__linkPath = $p;
}
function SetName($CtrlName)
{
$this->__controlName = $CtrlName;
}
function SetStyles($style)
{
$this->__styles = $style;
}
function SetWidth($Width)
{
$this->__controlWidth = $Width;
}
function SetHeight($Height)
{
$this->__controlHeight = $Height;
}
function SetBaseHref($BaseHref)
{
$this->__baseHref = $BaseHref;
}
function SetFlashPath($FlashPath)
{
$this->__flashPath = $FlashPath;
}
function SetMediaPath($Path)
{
$this->__mediaPath = $Path;
}
function SetValue($HTMLValue)
{
// modified for v5.0
$this->__initialValueNoBase = $HTMLValue;
if ($this->__docType == DE_DOC_TYPE_SNIPPET) {
if ($this->__baseHref != "") {
$HTMLValue = "
tag for a new line, add
instead
$this->__useSingleLineReturn = 0;
}
function LoadHTMLFromMySQLQuery($DatabaseServer, $DatabaseName, $DatabaseUser, $DatabasePassword, $DatabaseQuery, &$ErrorDesc)
{
// Grabs a value from a MySQL database based on a SELECT query.
// It will return a text value from the field on success, or false on failure
$sConn = false;
$dConn = false;
$mRow = false;
$mResult = false;
if (!$sConn = @mysql_connect($DatabaseServer, $DatabaseUser, $DatabasePassword)) {
// Server connection failed
$ErrorDesc = mysql_error();
return false;
} else {
// Server connection was successful
if (! $dConn = @mysql_select_db($DatabaseName, $sConn)) {
// Database connection failed
$ErrorDesc = mysql_error();
return false;
} else {
// Database connection was successful
if (!$mResult = @mysql_query($DatabaseQuery)) {
// Query Failed
$ErrorDesc = mysql_error();
return false;
} else {
// Query was OK. Did it return a row?
if (@mysql_num_rows($mResult) == 0) {
// No rows returned
$ErrorDesc = mysql_error();
return false;
} else {
// Grab the first row's contents and return it
if (!$mRow = mysql_fetch_row($mResult)) {
// Error returning row
$ErrorDesc = mysql_error();
return false;
} else {
// Set the contents of the DevEdit control to this value
$this->SetValue($mRow[0]);
return true;
}
}
}
}
}
}
function LoadFromFile($FilePath, &$ErrorDesc)
{
$this->__loadedFile = $FilePath;
// Grabs the contents of a file and sets the value
// of the DevEdit control to the text in this file
$fp = false;
if (!$fp = @fopen($FilePath, "rb")) {
// Failed to open the file
$ErrorDesc = "Failed to open file $FilePath";
return false;
} else {
$data = "";
// File was opened OK, read it in
while (!feof($fp)) {
$data .= fgets($fp, 4096);
}
// Set the value to the contents of this file
$this->SetValue($data);
return true;
}
}
function SaveToFile($FilePath, &$ErrorDesc)
{
$fp = false;
// Writes the contents of the DevEdit control to a file
if (strlen($this->GetValue(false)) == 0) {
// No data to write to the file
$ErrorDesc = "Cannot save an empty value to $FilePath";
return false;
} else {
// The form has been submitted, save its contents
if (! $fp = @fopen($FilePath, "w")) {
// Failed to open the file
$ErrorDesc = "Failed to open file $FilePath";
return false;
} else {
// File was opened OK, write to it
if (! is_writable($FilePath)) {
// Can't write to the file
$ErrorDesc = "You do not have write permissions for $FilePath";
return false;
} else {
if (! fwrite($fp, $this->GetValue(false))) {
// Failed to write to the file
$ErrorDesc = "An error occured while writing to $FilePath";
return false;
} else {
// Write went OK
return true;
}
}
}
}
}
function AddCustomInsert($InsertName, $InsertHTMLCode)
{
$this->__hasCustomInserts = true;
$this->__customInsertArray[] = array("Name" => $InsertName, "HTML" => $InsertHTMLCode);
}
function AddCustomLink($LinkName, $LinkURL, $TargetWindow = "")
{
$this->__hasCustomLinks = true;
$this->__customLinkArray[] = array("Name" => $LinkName, "URL" => $LinkURL, "Target" => $TargetWindow);
}
function AddImageLibrary($LibraryName, $LibraryPath)
{
if (!in_array($LibraryName, $this->__imageLibsArray)) {
$this->__hasImageLibraries = true;
$this->__imageLibsArray[] = array($LibraryName, $LibraryPath);
}
}
function AddFlashLibrary($LibraryName, $LibraryPath)
{
if (!in_array($LibraryName, $this->__flashLibsArray)) {
$this->__hasFlashLibraries = true;
$this->__flashLibsArray[] = array($LibraryName, $LibraryPath);
}
}
function __FormatCustomInsertText()
{
// Private Function - This function will return all of the custom inserts as JavaScript arrays
if ($this->__hasCustomInserts == true) {
$ciText = "[";
for ($i = 0; $i < sizeof($this->__customInsertArray); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customInsertArray[$i]["Name"]));
$html = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customInsertArray[$i]["HTML"]));
$ciText .= "[\"" . $name . "\", \"" . $html . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
} else {
$ciText = "[]";
}
return $ciText;
}
function __FormatCustomLinkText()
{
// Private Function - This function will return all of the custom links as JavaScript arrays
if ($this->__hasCustomLinks == true) {
$ciText = "[";
for ($i = 0; $i < sizeof($this->__customLinkArray); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Name"]));
$url = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["URL"]));
$target = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Target"]));
$ciText .= "[\"" . $name . "\", \"" . $url . "\",\"" . $target . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
} else {
$ciText = "[]";
}
return $ciText;
}
function __FormatToolbarList()
{
if ($this->__toolbarset == true) {
$ciText = "[";
for ($i = 0; $i < sizeof($this->__toolbarset); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Name"]));
$url = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["URL"]));
$target = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Target"]));
$ciText .= "[\"" . $name . "\", \"" . $url . "\",\"" . $target . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
} else {
$ciText = "[]";
}
return $ciText;
}
function GetImageLibraries()
{
// Private Function - This function will return all of the image libraries as JavaScript arrays
$ciText = "";
if ($this->__hasImageLibraries == true) {
for ($i = 0; $i < sizeof($this->__imageLibsArray); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__imageLibsArray[$i][0]));
$dir = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__imageLibsArray[$i][1]));
$ciText .= "";
}
}
return str_replace("'", "\'", $ciText);
}
function GetFlashLibraries()
{
// Private Function - This function will return all of the flash libraries as JavaScript arrays
$ciText = "";
if ($this->__hasFlashLibraries == true) {
for ($i = 0; $i < sizeof($this->__flashLibsArray); $i++) {
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__flashLibsArray[$i][0]));
$dir = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__flashLibsArray[$i][1]));
$ciText .= "";
}
}
return str_replace("'", "\'", $ciText);
}
function SetSnippetStyleSheet($StyleSheetURL)
{
// Sets the location of the stylesheet for a code snippet
$this->__docType = DE_DOC_TYPE_SNIPPET;
$this->__snippetCSS = $StyleSheetURL;
}
function SetTextAreaDimensions($Cols, $Rows)
{
// Sets the rows and cols attributes of the