📄 settemplate.cgi
字号:
#!/usr/bin/perl
#############################################################
# Ikonboard v2.1
# Copyright 2000 Ikondiscussion.com - All Rights Reserved
# Ikondiscussion is a trademark of Ikondiscussion.com
#
# Software Distributed by: Ikondiscussion.com
# Visit us online at http://www.ikondiscussion.com
# Email us on boards@ikondiscussion.com
#
# All files written by Matthew Mecham
#############################################################
#use CGI::Carp "fatalsToBrowser"; # Output errors to browser
use CGI qw(:standard); # Saves loads of work
$CGI::POST_MAX=1024 * 150; # limit post data
$CGI::DISABLE_UPLOADS = 1; # Disable uploads
eval {
($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1");
require "ikon.lib"; # Require ikonboard ()
require "ikonadmin.lib"; # Require Admin func()
require "data/progs.cgi"; # Require prog names
require "data/boardinfo.cgi"; # Require board info
require "data/styles.cgi"; # Require styles info
require "data/boardstats.cgi";# Require styles info
};
if ($@) {
print header(-charset=>"gb2312"); print start_html(-title=>"ib2000 出错!");
print "不能够找到文件:$@\n如果您使用的是 Windows 类操作系统,请在每一个程序中更改 require 的设置,填入绝对路径!";
print end_html; exit;
}
$|++; # Unbuffer the output
#################--- Begin the program ---###################
$thisprog = "settemplate.cgi";
# sort out the incoming CGI
$query = new CGI;
&checkVALIDITY;
$boardurltemp =$boardurl;
$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
$cookiepath = $boardurltemp;
$cookiepath =~ s/$thisprog//sg;
$process = $query ->param("process");
$action = $query ->param("action");
$inmembername = cookie("adminname");
$inpassword = cookie("adminpass");
if ($process ne "preview template") {
print header(-charset=>"gb2312");
&admintitle;
}
&getmember("$inmembername");
if (($membercode eq "ad") && ($inpassword eq $password) && ($inmembername eq $membername)) {
print qq(
<tr><td bgcolor=#333333" ><font face=宋体 color=#FFFFFF>
<b>欢迎来到论坛管理中心 / 编辑论坛模板</b>
</td></tr>);
unless(defined($process)) {
# Get the template file
$templatefile = "$ikondir" . "data/template.dat";
# Is it there?....
if (-e $templatefile) {
open (TEMPLATE, "$templatefile");
local $/ = undef;
$template_data = <TEMPLATE>;
close (TEMPLATE);
}
else {
print qq(<tr><td><font face="宋体" color="#FF0000">
<b>不能够找到模板文件</b><br>
请确定文件 'template.dir' 在 *.cgi 程序目录下的 'data' 目录中!
</td></tr></table></td></tr></table></body></html>);
exit;
} # end is it there
# ....Is it writable?
unless (-w $templatefile) {
print qq(<tr><td><font face="宋体" color="#FF0000">
<b>不能够写入模板文件</b><br><br>
请确定 'data/template.dat' 文件的属性设置成了 666 !
</td></tr></table></td></tr></table></body></html>);
exit;
}
# If we're here, lets print out the template....
($non_editable, $user_editable) = split(/\<!--end Java-->/, $template_data);
$non_editable =~ s/</</g;
$non_editable =~ s/>/>/g;
$non_editable =~ s/\"/"/g;
$user_editable =~ s/</</g;
$user_editable =~ s/>/>/g;
$user_editable =~ s/\"/"/g;
print qq(
<tr>
<td colspan=2>
<form action="$thisprog" method=POST name="the_form">
<input type="hidden" name="non_editable" value="$non_editable">
<input type="hidden" name=process value="true">
<textarea name="template_info" wrap="soft" cols="85" rows="20">
$user_editable
</textarea>
<br><br>
<input type="submit" value="模板预览" onclick="preview_template();">
<input type="submit" value="保存模板" onclick="save_changes();">
</form>
<br><hr color=#000000>
<font face="宋体" color="#000000">
<b>编辑模板文件帮助</b><br>
您可以在这里编辑模板文件,如果您不懂CSS,请不要改动。
<br>
单词 '\$ikonboard_main' 是用来显示论坛内容, 从头部一直到页底版权信息链接。
你可以把 '\$ikonboard_main' 放在一个表格内,但请不要改变他的名字!
<br><br>
如果你想预览结果,请点击 '预览' 按钮。
<br>
<b>请保证您没有删除 </head>,</body> and </html> 标签!</b><br>
如果没有 <html> 标签,那么本程序会在头部自动给出。
</td>
</tr>
);
} # end if def(process)
else {
$template_info = $query -> param("template_info");
$header_info = $query -> param("non_editable");
$header_info =~ s/</</g;
$header_info =~ s/>/>/g;
$header_info =~ s/"/\"/g;
$template_info =~ s/</</g;
$template_info =~ s/>/>/g;
$template_info =~ s/"/\"/g;
if ($process eq "preview template") {
print header(-charset=>"gb2312");
&title;
$temp_board = qq(
<table width=$tablewidth border=1 align=center><tr><td>
$output
<br><br><br><br><br>
<font face="宋体" color=#000000>
<center><h1>ib2000 的预览结果</h1>
请注意设置还没有存入!<br>
要保存模板设置,请返回管理中心点击 '保存模板'。
<br><br>
如果您希望编辑论坛的宽度,请进入管理中心的 "风格结构" 中的 "表格颜色" 模块,<BR>
修改 "所有表格宽度" 即可,你也可以将其设置成百分比(比如:90%)。<br>
保存后,再回到 "编辑论坛模板",重新预览!</center>
<br><br><br><br><br><br><br>
<table width=80% align=center cellpadding=3 cellspacing=0>
<tr><td align=center valign=middle>
<font face=宋体 color=#000000>
<a href="http://www.cgier.com">CGI 编程者之家</a><br>© 2000 CGIer.com
</font></td></tr></table>
<p></td></tr></table></body></html>);
$template_info =~ s/\$ikonboard_main/$temp_board\n/sg;
print $header_info;
print $template_info;
}
else {
$templatefile = "$ikondir" . "data/template.dat";
open (TEMPLATE, ">$templatefile") or die "不能找到文件或不能写入";
flock (TEMPLATE, 2) if ($OS_USED eq "Unix");
print TEMPLATE "$header_info\n";
print TEMPLATE "<!--end Java-->\n";
print TEMPLATE $template_info;
close (TEMPLATE);
print "<tr><td><font face=宋体><b>所有模板信息已经写入</b></font></td></tr>";
}
}
} # end if logged in
else {
&adminlogin;
}
print qq(</table></td></tr></table></td></tr></table></body></html>) if ($process ne "preview template");
exit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -