📄 style.php
字号:
<?php
function ewebeditor_content( )
{
switch ( $sAction )
{
case "UPDATECONFIG" :
doupdateconfig( );
break;
case "COPY" :
initstyle( );
docopy( );
showstylelist( );
break;
case "STYLEADD" :
showstyleform( "ADD" );
break;
case "STYLESET" :
initstyle( );
showstyleform( "SET" );
break;
case "STYLEADDSAVE" :
checkstyleform( );
dostyleaddsave( );
break;
case "STYLESETSAVE" :
checkstyleform( );
dostylesetsave( );
break;
case "STYLEDEL" :
initstyle( );
dostyledel( );
showstylelist( );
break;
case "CODE" :
initstyle( );
showstylecode( );
break;
case "TOOLBAR" :
initstyle( );
showtoolbarlist( );
break;
case "TOOLBARADD" :
initstyle( );
dotoolbaradd( );
showtoolbarlist( );
break;
case "TOOLBARMODI" :
initstyle( );
dotoolbarmodi( );
showtoolbarlist( );
break;
case "TOOLBARDEL" :
initstyle( );
dotoolbardel( );
showtoolbarlist( );
break;
case "BUTTONSET" :
initstyle( );
inittoolbar( );
showbuttonlist( );
break;
case "BUTTONSAVE" :
initstyle( );
inittoolbar( );
dobuttonsave( );
break;
default :
showstylelist( );
break;
}
}
function showposition( )
{
echo "<table border=0 cellspacing=1 align=center class=navi><tr><th>".$sPosition."</th></tr>"."<tr><td align=center>[<a href='?'>所有样式列表</a>] [<a href='?action=styleadd'>新建一样式</a>] [<a href='?action=updateconfig'>更新所有样式的前台配置文件</a>] [<a href='#' onclick='history.back()'>返回前一页</a>]</td></tr>"."</table><br>";
}
function showmessage( $str )
{
echo "<table border=0 cellspacing=1 align=center class=list><tr><td>".$str."</td></tr></table><br>";
}
function showstylelist( )
{
showmessage( "<b class=blue>以下为当前所有样式列表:</b>" );
echo "<table border=0 cellpadding=0 cellspacing=1 class=list align=center><form action='?action=del' method=post name=myform><tr align=center><th width='10%'>样式名</th><th width='10%'>最佳宽度</th><th width='10%'>最佳高度</th><th width='45%'>说明</th><th width='25%'>管理</th></tr>";
$i = 1;
for ( ; $i <= count( $GLOBALS['aStyle'] ); ++$i )
{
$aCurrStyle = explode( "|||", $GLOBALS['aStyle'][$i] );
$sManage = "<a href='?action=stylepreview&id=".$i."' target='_blank'>预览</a>|<a href='?action=code&id=".$i."'>代码</a>|<a href='?action=styleset&id=".$i."'>设置</a>|<a href='?action=toolbar&id=".$i."'>工具栏</a>|<a href='?action=copy&id=".$i."'>拷贝</a>|<a href='?action=styledel&id=".$i."' onclick=\"return confirm('提示:您确定要删除此样式吗?')\">删除</a>";
echo "<tr align=center><td>".htmlspecialchars( $aCurrStyle[0] )."</td>"."<td>".$aCurrStyle[4]."</td>"."<td>".$aCurrStyle[5]."</td>"."<td align=left>".htmlspecialchars( $aCurrStyle[26] )."</td>"."<td>".$sManage."</td>"."</tr>";
}
echo "</table><br>";
showmessage( "<b class=blue>提示:</b>你可以通过“拷贝”一样式以达到快速新建样式的目的。" );
}
function docopy( )
{
$b = false;
$i = 0;
while ( $b == false )
{
$i = $i + 1;
$sNewName = $sStyleName.$i;
if ( stylename2id( $sNewName ) == -1 )
{
$b = true;
}
}
$nNewStyleID = count( $GLOBALS['aStyle'] ) + 1;
$GLOBALS['aStyle'][$nNewStyleID] = $sNewName.substr( $GLOBALS['aStyle'][$nStyleID], strlen( $GLOBALS['sStyleName'] ) );
$nToolbarNum = count( $GLOBALS['aToolbar'] );
$i = 1;
for ( ; $i <= $nToolbarNum; ++$i )
{
$aCurrToolbar = explode( "|||", $GLOBALS['aToolbar'][$i] );
if ( $aCurrToolbar[0] == $sStyleID )
{
$nNewToolbarID = count( $GLOBALS['aToolbar'] ) + 1;
$GLOBALS['aToolbar'][$nNewToolbarID] = $nNewStyleID."|||".$aCurrToolbar[1]."|||".$aCurrToolbar[2]."|||".$aCurrToolbar[3];
}
}
writeconfig( );
writestyle( $nNewStyleID );
gourl( "?" );
}
function stylename2id( $str )
{
$i = 1;
for ( ; $i <= count( $GLOBALS['aStyle'] ); ++$i )
{
$aTemp = explode( "|||", $GLOBALS['aStyle'][$i] );
if ( strtolower( $aTemp[0] ) == strtolower( $str ) )
{
return $i;
}
}
return -1;
}
function showstyleform( $sFlag )
{
if ( $sFlag == "ADD" )
{
$GLOBALS['sStyleID'] = "";
$GLOBALS['sStyleName'] = "";
$GLOBALS['sStyleDir'] = "standard";
$GLOBALS['sStyleCSS'] = "office";
$GLOBALS['sStyleUploadDir'] = "UploadFile/";
$GLOBALS['sStyleBaseHref'] = "http://Localhost/eWebEditor/";
$GLOBALS['sStyleContentPath'] = "UploadFile/";
$GLOBALS['sStyleWidth'] = "600";
$GLOBALS['sStyleHeight'] = "400";
$GLOBALS['sStyleMemo'] = "";
$GLOBALS['nStyleIsSys'] = 0;
$s_Title = "新增样式";
$s_Action = "StyleAddSave";
$GLOBALS['sStyleFileExt'] = "rar|zip|exe|doc|xls|chm|hlp";
$GLOBALS['sStyleFlashExt'] = "swf";
$GLOBALS['sStyleImageExt'] = "gif|jpg|jpeg|bmp";
$GLOBALS['sStyleMediaExt'] = "rm|mp3|wav|mid|midi|ra|avi|mpg|mpeg|asf|asx|wma|mov";
$GLOBALS['sStyleRemoteExt'] = "gif|jpg|bmp";
$GLOBALS['sStyleFileSize'] = "500";
$GLOBALS['sStyleFlashSize'] = "100";
$GLOBALS['sStyleImageSize'] = "100";
$GLOBALS['sStyleMediaSize'] = "100";
$GLOBALS['sStyleRemoteSize'] = "100";
$GLOBALS['sStyleStateFlag'] = "1";
$GLOBALS['sStyleAutoRemote'] = "1";
$GLOBALS['sStyleShowBorder'] = "0";
$GLOBALS['sAutoDetectLanguage'] = "1";
$GLOBALS['sDefaultLanguage'] = "zh-cn";
$GLOBALS['sStyleUploadObject'] = "0";
$GLOBALS['sStyleAutoDir'] = "0";
$GLOBALS['sStyleDetectFromWord'] = "1";
$GLOBALS['sStyleInitMode'] = "EDIT";
$GLOBALS['sStyleBaseUrl'] = "1";
$GLOBALS['sSLTFlag'] = "0";
$GLOBALS['sSLTMinSize'] = "300";
$GLOBALS['sSLTOkSize'] = "120";
$GLOBALS['sSYFlag'] = "0";
$GLOBALS['sSYText'] = "版权所有...";
$GLOBALS['sSYFontColor'] = "000000";
$GLOBALS['sSYFontSize'] = "12";
$GLOBALS['sSYFontName'] = "宋体";
$GLOBALS['sSYPicPath'] = "";
$GLOBALS['sSLTSYObject'] = "0";
$GLOBALS['sSLTSYExt'] = "bmp|jpg|jpeg|gif";
$GLOBALS['sSYMinSize'] = "100";
$GLOBALS['sSYShadowColor'] = "FFFFFF";
$GLOBALS['sSYShadowOffset'] = "1";
}
else
{
$GLOBALS['sStyleName'] = htmlspecialchars( $GLOBALS['sStyleName'] );
$GLOBALS['sStyleDir'] = htmlspecialchars( $GLOBALS['sStyleDir'] );
$GLOBALS['sStyleCSS'] = htmlspecialchars( $GLOBALS['sStyleCSS'] );
$GLOBALS['sStyleUploadDir'] = htmlspecialchars( $GLOBALS['sStyleUploadDir'] );
$GLOBALS['sStyleBaseHref'] = htmlspecialchars( $GLOBALS['sStyleBaseHref'] );
$GLOBALS['sStyleContentPath'] = htmlspecialchars( $GLOBALS['sStyleContentPath'] );
$GLOBALS['sStyleMemo'] = htmlspecialchars( $GLOBALS['sStyleMemo'] );
$GLOBALS['sSYText'] = htmlspecialchars( $GLOBALS['sSYText'] );
$GLOBALS['sSYFontColor'] = htmlspecialchars( $GLOBALS['sSYFontColor'] );
$GLOBALS['sSYFontSize'] = htmlspecialchars( $GLOBALS['sSYFontSize'] );
$GLOBALS['sSYFontName'] = htmlspecialchars( $GLOBALS['sSYFontName'] );
$GLOBALS['sSYPicPath'] = htmlspecialchars( $GLOBALS['sSYPicPath'] );
$s_Title = "设置样式";
$s_Action = "StyleSetSave";
}
$s_FormStateFlag = initselect( "d_stateflag", explode( "|", "显示|不显示" ), explode( "|", "1|0" ), $GLOBALS['sStyleStateFlag'], "", "" );
$s_FormAutoRemote = initselect( "d_autoremote", explode( "|", "自动上传|不自动上传" ), explode( "|", "1|0" ), $GLOBALS['sStyleAutoRemote'], "", "" );
$s_FormShowBorder = initselect( "d_showborder", explode( "|", "默认显示|默认不显示" ), explode( "|", "1|0" ), $GLOBALS['sStyleShowBorder'], "", "" );
$s_FormAutoDetectLanguage = initselect( "d_autodetectlanguage", explode( "|", "自动检测|不自动检测" ), explode( "|", "1|0" ), $GLOBALS['sAutoDetectLanguage'], "", "" );
$s_FormDefaultLanguage = initselect( "d_defaultlanguage", explode( "|", "简体中文|繁体中文|英文" ), explode( "|", "zh-cn|zh-tw|en" ), $GLOBALS['sDefaultLanguage'], "", "" );
$s_FormUploadObject = initselect( "d_uploadobject", explode( "|", "自带" ), explode( "|", "0" ), $GLOBALS['sStyleUploadObject'], "", "" );
$s_FormAutoDir = initselect( "d_autodir", explode( "|", "不使用|年目录|年月目录|年月日目录" ), explode( "|", "0|1|2|3" ), $GLOBALS['sStyleAutoDir'], "", "" );
$s_FormDetectFromWord = initselect( "d_detectfromword", explode( "|", "自动检测有提示|不自动检测" ), explode( "|", "1|0" ), $GLOBALS['sStyleDetectFromWord'], "", "" );
$s_FormInitMode = initselect( "d_initmode", explode( "|", "代码模式|编辑模式|文本模式|预览模式" ), explode( "|", "CODE|EDIT|TEXT|VIEW" ), $GLOBALS['sStyleInitMode'], "", "" );
$s_FormBaseUrl = initselect( "d_baseurl", explode( "|", "相对路径|绝对根路径|绝对全路径" ), explode( "|", "0|1|2" ), $GLOBALS['sStyleBaseUrl'], "", "" );
$s_FormSLTFlag = initselect( "d_sltflag", explode( "|", "使用|不使用" ), explode( "|", "1|0" ), $GLOBALS['sSLTFlag'], "", "" );
$s_FormSYFlag = initselect( "d_syflag", explode( "|", "不使用|文字水印|图片水印" ), explode( "|", "0|1|2" ), $GLOBALS['sSYFlag'], "", "" );
$s_FormSLTSYObject = initselect( "d_sltsyobject", explode( "|", "PHP GD2图形库" ), explode( "|", "0" ), $GLOBALS['sSLTSYObject'], "", "" );
$s_Button = "<tr><td align=center colspan=4><input type=submit value=' 提交 ' align=absmiddle> <input type=reset name=btnReset value=' 重填 '></td></tr>";
echo "<table border=0 cellpadding=0 cellspacing=1 align=center class=form><form action='?action=".$s_Action."&id=".$sStyleID."' method=post name=myform>"."<tr><th colspan=4> ".$s_Title."(鼠标移到输入框可看说明,带*号为必填项)</th></tr>"."<tr><td width='15%'>样式名称:</td><td width='35%'><input type=text class=input size=20 name=d_name title='引用此样式的名字,不要加特殊符号,最大50个字符长度' value=\"".$sStyleName."\"> <span class=red>*</span></td><td width='15%'>初始模式:</td><td width='35%'>".$s_FormInitMode." <span class=red>*</span></td></tr>"."<tr><td width='15%'>上传组件:</td><td width='35%'>".$s_FormUploadObject." <span class=red>*</span></td><td width='15%'>自动目录:</td><td width='35%'>".$s_FormAutoDir." <span class=red>*</span></td></tr>"."<tr><td width='15%'>图片目录:</td><td width='35%'><input type=text class=input size=20 name=d_dir title='存放此样式图片文件的目录名,必须在ButtonImage下,最大50个字符长度' value=\"".$sStyleDir."\"> <span class=red>*</span></td><td width='15%'>样式目录:</td><td width='35%'><input type=text class=input size=20 name=d_css title='存放此样式css文件的目录名,必须在CSS下,最大50个字符长度' value=\"".$sStyleCSS."\"> <span class=red>*</span></td></tr>"."<tr><td width='15%'>最佳宽度:</td><td width='35%'><input type=text class=input name=d_width size=20 title='最佳引用效果的宽度,数字型' value='".$sStyleWidth."'> <span class=red>*</span></td><td width='15%'>最佳高度:</td><td width='35%'><input type=text class=input name=d_height size=20 title='最佳引用效果的高度,数字型' value='".$sStyleHeight."'> <span class=red>*</span></td></tr>"."<tr><td width='15%'>状 态 栏:</td><td width='35%'>".$s_FormStateFlag." <span class=red>*</span></td><td width='15%'>Word粘贴:</td><td width='35%'>".$s_FormDetectFromWord." <span class=red>*</span></td></tr>"."<tr><td width='15%'>远程文件:</td><td width='35%'>".$s_FormAutoRemote." <span class=red>*</span></td><td width='15%'>指导方针:</td><td width='35%'>".$s_FormShowBorder." <span class=red>*</span></td></tr>"."<tr><td width='15%'>自动语言检测:</td><td width='35%'>".$s_FormAutoDetectLanguage." <span class=red>*</span></td><td width='15%'>默认语言:</td><td width='35%'>".$s_FormDefaultLanguage." <span class=red>*</span></td></tr>"."<tr><td>备注说明:</td><td colspan=3><input type=text name=d_memo size=90 title='此样式的说明,更有利于调用' value=\"".$sStyleMemo."\"></td></tr>"."<tr><td colspan=4><span class=red> 允许上传文件类型及文件大小设置(文件大小单位为KB,0表示没有限制):</span></td></tr>"."<tr><td width='15%'>图片类型:</td><td width='35%'><input type=text class=input name=d_imageext size=20 title='用于图片相关的上传,最大250个字符长度' value='".$sStyleImageExt."'></td><td width='15%'>图片限制:</td><td width='35%'><input type=text class=input name=d_imagesize size=20 title='数字型,单位KB' value='".$sStyleImageSize."'></td></tr>"."<tr><td width='15%'>Flash类型:</td><td width='35%'><input type=text class=input name=d_flashext size=20 title='用于插入Flash动画,最大250个字符长度' value='".$sStyleFlashExt."'></td><td width='15%'>Flash限制:</td><td width='35%'><input type=text class=input name=d_flashsize size=20 title='数字型,单位KB' value='".$sStyleFlashSize."'></td></tr>"."<tr><td width='15%'>媒体类型:</td><td width='35%'><input type=text class=input name=d_mediaext size=20 title='用于插入媒体文件,最大250个字符长度' value='".$sStyleMediaExt."'></td><td width='15%'>媒体限制:</td><td width='35%'><input type=text class=input name=d_mediasize size=20 title='数字型,单位KB' value='".$sStyleMediaSize."'></td></tr>"."<tr><td width='15%'>其它类型:</td><td width='35%'><input type=text class=input name=d_fileext size=20 title='用于插入其它文件,最大250个字符长度' value='".$sStyleFileExt."'></td><td width='15%'>其它限制:</td><td width='35%'><input type=text class=input name=d_filesize size=20 title='数字型,单位KB' value='".$sStyleFileSize."'></td></tr>"."<tr><td width='15%'>远程类型:</td><td width='35%'><input type=text class=input name=d_remoteext size=20 title='用于自动上传远程文件,最大250个字符长度' value='".$sStyleRemoteExt."'></td><td width='15%'>远程限制:</td><td width='35%'><input type=text class=input name=d_remotesize size=20 title='数字型,单位KB' value='".$sStyleRemoteSize."'></td></tr>"."<tr><td colspan=4><span class=red> 缩略图及水印相关设置:</span></td></tr>"."<tr><td width='15%'>图形处理组件:</td><td width='35%'>".$s_FormSLTSYObject."</td><td width='15%'>处理图形扩展名:</td><td width='35%'><input type=text name=d_sltsyext size=20 class=input value=\"".$sSLTSYExt."\"></td></tr>"."<tr><td width='15%'>缩略图使用状态:</td><td width='35%'>".$s_FormSLTFlag."</td><td width='15%'>缩略图长度条件</td><td width='35%'><input type=text name=d_sltminsize size=20 class=input title='图形的长度只有达到此最小长度要求时才会生成缩略图,数字型' value='".$sSLTMinSize."'>px</td></tr>"."<tr><td width='15%'>缩略图生成长度:</td><td width='35%'><input type=text name=d_sltoksize size=20 class=input title='生成的缩略图长度值,数字型' value='".$sSLTOkSize."'>px</td><td width='15%'> </td><td width='35%'> </td></tr>"."<tr><td width='15%'>水印使用状态:</td><td width='35%'>".$s_FormSYFlag."</td><td width='15%'>水印宽度条件:</td><td width='35%'><input type=text name=d_syminsize size=20 class=input title='图形的宽度只有达到此最小宽度要求时才会生成水印,数字型' value='".$sSYMinSize."'>px</td></tr>"."<tr><td width='15%'>文字水印内容:</td><td width='35%'><input type=text name=d_sytext size=20 class=input title='当使用文字水印时的文字内容' value=\"".$sSYText."\"></td><td width='15%'>文字水印字体颜色:</td><td width='35%'><input type=text name=d_syfontcolor size=20 class=input title='当使用文字水印时文字的颜色' value=\"".$sSYFontColor."\"></td></tr>"."<tr><td width='15%'>文字水印阴影颜色:</td><td width='35%'><input type=text name=d_syshadowcolor size=20 class=input title='当使用文字水印时的文字阴影颜色' value=\"".$sSYShadowColor."\"></td><td width='15%'>文字水印阴影大小:</td><td width='35%'><input type=text name=d_syshadowoffset size=20 class=input title='当使用文字水印时文字的阴影大小' value=\"".$sSYShadowOffset."\">px</td></tr>"."<tr><td width='15%'>文字水印字体大小:</td><td width='35%'><input type=text name=d_syfontsize size=20 class=input title='当使用文字水印时文字的字体大小' value=\"".$sSYFontSize."\">px</td><td width='15%'>中文字体库及路径:</td><td width='35%'><input type=text name=d_syfontname size=20 class=input title='当使用中文字时,字体库的文件名' value=\"".$sSYFontName."\"> <a href='#fontname'>说明</a></td></tr>"."<tr><td width='15%'>图片水印图片路径:</td><td width='35%'><input type=text name=d_sypicpath size=20 class=input title='当使用图片水印时图片的路径' value=\"".$sSYPicPath."\"></td><td width='15%'></td><td width='35%'></td></tr>".$s_Button."</form>"."</table><br>";
$sMsg = "<a name=baseurl></a><p><span class=blue><b>路径模式设置说明:</b></span><br><b>相对路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以\"UploadFile/...\"或\"../UploadFile/...\"形式呈现,当使用此模式时,显示路径和内容路径必填,显示路径必须以\"/\"开头和结尾,内容路径设置中不能以\"/\"开头。<br><b>绝对根路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以\"/eWebEditor/UploadFile/...\"这种形式呈现,当使用此模式时,显示路径和内容路径不必填。<br><b>绝对全路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以\"http://xxx.xxx.xxx/eWebEditor/UploadFile/...\"这种形式呈现,当使用此模式时,显示路径和内容路径不必填。</p><a name=fontname></a><p><span class=blue><b>中文字体库及路径设置说明:</b></span><br>当使用中文文字水印时必填一个字库,使用英文水印时为提高效率请留空,如设为“simkai.ttf”,则请把此字体库文件拷贝到编辑器的php目录。</p>";
showmessage( $sMsg );
}
function initstyle( )
{
global $sStyleID;
global $sStyleName;
global $sStyleDir;
global $sStyleCSS;
global $sStyleUploadDir;
global $sStyleWidth;
global $sStyleHeight;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -