如何在ubb中实现html

gnaw0725 2003-09-02 10:05:58
在客户端,由于论坛只限用ubb代码,不能用html,
很不方便,不知有什么办法,让ubb执行特殊的html代码?
比如marquee等
...全文
90 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
blueoxygen 2003-09-06
  • 打赏
  • 举报
回复
你可以自己修改UBB代码类,添加安全的HTML代码
如果,不那么做的话,你可以在客户提交的时候让他选择是否使用UBB代码类啊
DFlyingchen 2003-09-02
  • 打赏
  • 举报
回复
这是一般ubb的解析类:
<?php
/************************************************************
* UBB 解析器 v1.0b
*
* 该解释器支持的是UBB的子集(标准集我也不知到啥样)
* 需要其他的可以自行扩展,
* 理论上支持任何[x=a,b,c]xxx[/x]结构的解析
*
* 源代码由zy提供,在此思路上重写了大部分代码
*
* 如果你有什么好的建议请联系 pazee@21cn.com
* 正则表达式的用法得到 z_yong@163.com 的大力支持,在此表示感谢
* 耙子 2001/12/31
* http://www.fogsun.com
*
* $ 转载请完整保留此段文字 $
*
* 使用说明
* 1.本代码未对html进行任何限制,仅增加了对UBB-〉Html的转换支持,
* 如果需要请在调用本代码前自行过滤html标签,
* 2.调用代码前请用 stripslashes 函数去掉转换内容中的冗余反斜杠,
* 否则结果可能会出现问题
* 3.UBB 标签中不允许出现空格
*************************************************************/

define ("sVersion", "1.2.1.15 beta");

//ubbcode类
class ubbcode
{
var $nest; // 递归深度,for debug
//可处理标签及处理函数表
var $tags = array(
'url' => '$this->url',
'email' => '$this->email',
'mail' => '$this->email', // 为了容错,[mail]和[email]等效
'img' => '$this->img',
'b' => '$this->simple',
'i' => '$this->simple',
'u' => '$this->simple',
'tt' => '$this->simple',
's' => '$this->simple',
'strike' => '$this->simple',
'h1' => '$this->simple',
'h2' => '$this->simple',
'h3' => '$this->simple',
'h4' => '$this->simple',
'h5' => '$this->simple',
'h6' => '$this->simple',
'sup' => '$this->simple',
'sub' => '$this->simple',
'em' => '$this->simple',
'strong' => '$this->simple',
'code' => '$this->simple',
'samp' => '$this->simple',
'kbd' => '$this->simple',
'var' => '$this->simple',
'dfn' => '$this->simple',
'cite' => '$this->simple',
'small' => '$this->simple',
'big' => '$this->simple',
'blink' => '$this->simple',
'fly' => '$this->fly',
'move' => '$this->move',
'glow' => '$this->CSSStyle',
'shadow' => '$this->CSSStyle',
'blur' => '$this->CSSStyle',
'wave' => '$this->CSSStyle',
'sub' => '$this->simple',
'sup' => '$this->simple',
'size' => '$this->size',
'face' => '$this->face',
'font' => '$this->face', // 为了容错,[font]和[face]等效
'color' => '$this->color'
);

function ubbcode()
{
$this->$nest= 0;
$this->$sLastModified= sprintf("%s", date("Y-m-j H:i", getlastmod()));
}


/***********************************************************************
* 对使用者输入的 E-Mail 作简单的检查,
* 检查使用者的 E-Mail 字串是否有 @ 字元,
* 在 @ 字元前有英文字母或数字,在之后有数节字串,
* 最后的小数点后只能有二个或三个英文字母。
* super@mail.wilson.gs 就可以通过检查,super@mail.wilson 就不能通过检查
************************************************************************/
function emailcheck($str)
{
if (eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $str))
return true;
else
return false;
}


/***********************************************************************
* 对使用者输入的 URL 作简单的检查,
* 目前只能简单判断,不能自动检查fpt,finger等
************************************************************************/
function checkURL($str)
{
$bValidURL= true;
if (eregi("([a-z0-9-]+([\.][a-z0-9\-]+)+)", $str, $er_arr))
{
/*
printf ("0. %s <br>\n", $er_arr[0]);
printf ("1. %s <br>\n", $er_arr[1]);
printf ("2. %s <br>\n", $er_arr[2]);
printf ("3. %s <br>\n", $er_arr[3]);
printf ("4. %s <br>\n", $er_arr[4]);
*/
}
else
$bValidURL= false;
return $bValidURL;
}

/***********************************************************************
* 对使用者输入的 图片URL 作简单的检查,
* 目前只能简单判断结尾是否为图片文件
* 不支持由CGI动态生成的图片,比如计数器这类的
************************************************************************/
function checkImgURL($str)

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧