Compare commits

..
6 Commits
Author SHA1 Message Date
chicpro 36ef8e6447 5.1.4 버전변경 2015-10-26 10:08:02 +09:00
chicpro eb154efa24 누락된 닫음태그 추가 2015-10-20 12:02:20 +09:00
chicpro 9bf15fdf32 htmlpurifier 4.7 버전 적용 2015-10-20 11:28:40 +09:00
chicpro 353a0d9409 XSS취약점관련 object 태그 허용설정 변경 2015-10-20 11:28:26 +09:00
chicpro 0535b6d26a post 값 필터링 코드 위치 변경 2015-10-20 11:26:30 +09:00
chicpro 1fe4684537 MySQLi 지원 추가 및 SMS5 수정 2015-10-16 10:12:06 +09:00
190 changed files with 31292 additions and 26818 deletions
-1
View File
@@ -6,7 +6,6 @@ $menu["menu900"] = array (
array('900300', '문자 보내기', ''.G5_SMS5_ADMIN_URL.'/sms_write.php', 'sms_write'), array('900300', '문자 보내기', ''.G5_SMS5_ADMIN_URL.'/sms_write.php', 'sms_write'),
array('900400', '전송내역-건별', ''.G5_SMS5_ADMIN_URL.'/history_list.php', 'sms_history' , 1), array('900400', '전송내역-건별', ''.G5_SMS5_ADMIN_URL.'/history_list.php', 'sms_history' , 1),
array('900410', '전송내역-번호별', ''.G5_SMS5_ADMIN_URL.'/history_num.php', 'sms_history_num' , 1), array('900410', '전송내역-번호별', ''.G5_SMS5_ADMIN_URL.'/history_num.php', 'sms_history_num' , 1),
array('900450', '전송내역-회원', ''.G5_SMS5_ADMIN_URL.'/history_member.php', 'sms_history_mb' , 1),
array('900500', '이모티콘 그룹', ''.G5_SMS5_ADMIN_URL.'/form_group.php' , 'emoticon_group'), array('900500', '이모티콘 그룹', ''.G5_SMS5_ADMIN_URL.'/form_group.php' , 'emoticon_group'),
array('900600', '이모티콘 관리', ''.G5_SMS5_ADMIN_URL.'/form_list.php', 'emoticon_list'), array('900600', '이모티콘 관리', ''.G5_SMS5_ADMIN_URL.'/form_list.php', 'emoticon_list'),
array('900700', '휴대폰번호 그룹', ''.G5_SMS5_ADMIN_URL.'/num_group.php' , 'hp_group', 1), array('900700', '휴대폰번호 그룹', ''.G5_SMS5_ADMIN_URL.'/num_group.php' , 'hp_group', 1),
+1 -1
View File
@@ -69,7 +69,7 @@ $result = sql_query($sql);
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php for ($i=0; $row=mysql_fetch_array($result); $i++) { <?php for ($i=0; $row=sql_fetch_array($result); $i++) {
$bg = 'bg'.($i%2); $bg = 'bg'.($i%2);
?> ?>
<tr class="<?php echo $bg; ?>"> <tr class="<?php echo $bg; ?>">
+1 -1
View File
@@ -21,7 +21,7 @@ if ($w == "")
$sql_common "; $sql_common ";
sql_query($sql); sql_query($sql);
$fa_id = mysql_insert_id(); $fa_id = sql_insert_id();
} }
else if ($w == "u") else if ($w == "u")
{ {
+1 -1
View File
@@ -31,7 +31,7 @@ if ($w == "")
$sql = " insert {$g5['faq_master_table']} $sql_common "; $sql = " insert {$g5['faq_master_table']} $sql_common ";
sql_query($sql); sql_query($sql);
$fm_id = mysql_insert_id(); $fm_id = sql_insert_id();
} }
else if ($w == "u") else if ($w == "u")
{ {
+1 -1
View File
@@ -93,7 +93,7 @@ $result = sql_query($sql);
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php for ($i=0; $row=mysql_fetch_array($result); $i++) { <?php for ($i=0; $row=sql_fetch_array($result); $i++) {
$sql1 = " select COUNT(*) as cnt from {$g5['faq_table']} where fm_id = '{$row['fm_id']}' "; $sql1 = " select COUNT(*) as cnt from {$g5['faq_table']} where fm_id = '{$row['fm_id']}' ";
$row1 = sql_fetch($sql1); $row1 = sql_fetch($sql1);
$cnt = $row1['cnt']; $cnt = $row1['cnt'];
+1 -1
View File
@@ -51,7 +51,7 @@ $colspan = 7;
</thead> </thead>
<tbody> <tbody>
<?php <?php
for ($i=0; $row=mysql_fetch_array($result); $i++) { for ($i=0; $row=sql_fetch_array($result); $i++) {
$s_vie = '<a href="./mail_preview.php?ma_id='.$row['ma_id'].'" target="_blank">미리보기</a>'; $s_vie = '<a href="./mail_preview.php?ma_id='.$row['ma_id'].'" target="_blank">미리보기</a>';
$num = number_format($total_count - ($page - 1) * $config['cf_page_rows'] - $i); $num = number_format($total_count - ($page - 1) * $config['cf_page_rows'] - $i);
+1 -1
View File
@@ -27,7 +27,7 @@ if($w == "")
$sql = " insert {$g5['new_win_table']} set $sql_common "; $sql = " insert {$g5['new_win_table']} set $sql_common ";
sql_query($sql); sql_query($sql);
$nw_id = mysql_insert_id(); $nw_id = sql_insert_id();
} }
else if ($w == "u") else if ($w == "u")
{ {
+1 -1
View File
@@ -70,7 +70,7 @@ $result = sql_query($sql);
</thead> </thead>
<tbody> <tbody>
<?php <?php
for ($i=0; $row=mysql_fetch_array($result); $i++) { for ($i=0; $row=sql_fetch_array($result); $i++) {
$bg = 'bg'.($i%2); $bg = 'bg'.($i%2);
switch($row['nw_device']) { switch($row['nw_device']) {
+1 -1
View File
@@ -17,7 +17,7 @@ if ($w == '')
values ( '{$_POST['po_subject']}', '{$_POST['po_poll1']}', '{$_POST['po_poll2']}', '{$_POST['po_poll3']}', '{$_POST['po_poll4']}', '{$_POST['po_poll5']}', '{$_POST['po_poll6']}', '{$_POST['po_poll7']}', '{$_POST['po_poll8']}', '{$_POST['po_poll9']}', '{$_POST['po_cnt1']}', '{$_POST['po_cnt2']}', '{$_POST['po_cnt3']}', '{$_POST['po_cnt4']}', '{$_POST['po_cnt5']}', '{$_POST['po_cnt6']}', '{$_POST['po_cnt7']}', '{$_POST['po_cnt8']}', '{$_POST['po_cnt9']}', '{$_POST['po_etc']}', '{$_POST['po_level']}', '{$_POST['po_point']}', '".G5_TIME_YMD."' ) "; values ( '{$_POST['po_subject']}', '{$_POST['po_poll1']}', '{$_POST['po_poll2']}', '{$_POST['po_poll3']}', '{$_POST['po_poll4']}', '{$_POST['po_poll5']}', '{$_POST['po_poll6']}', '{$_POST['po_poll7']}', '{$_POST['po_poll8']}', '{$_POST['po_poll9']}', '{$_POST['po_cnt1']}', '{$_POST['po_cnt2']}', '{$_POST['po_cnt3']}', '{$_POST['po_cnt4']}', '{$_POST['po_cnt5']}', '{$_POST['po_cnt6']}', '{$_POST['po_cnt7']}', '{$_POST['po_cnt8']}', '{$_POST['po_cnt9']}', '{$_POST['po_etc']}', '{$_POST['po_level']}', '{$_POST['po_point']}', '".G5_TIME_YMD."' ) ";
sql_query($sql); sql_query($sql);
$po_id = mysql_insert_id(); $po_id = sql_insert_id();
} }
else if ($w == 'u') else if ($w == 'u')
{ {
+1 -1
View File
@@ -16,7 +16,7 @@ $sql_order = " order by cnt desc ";
$sql = " select pp_word {$sql_common} {$sql_search} {$sql_group} "; $sql = " select pp_word {$sql_common} {$sql_search} {$sql_group} ";
$result = sql_query($sql); $result = sql_query($sql);
$total_count = mysql_num_rows($result); $total_count = sql_num_rows($result);
$rows = $config['cf_page_rows']; $rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산 $total_page = ceil($total_count / $rows); // 전체 페이지 계산
+1 -1
View File
@@ -5,7 +5,7 @@ include_once(G5_ADMIN_PATH.'/admin.lib.php');
include_once(G5_SMS5_PATH.'/sms5.lib.php'); include_once(G5_SMS5_PATH.'/sms5.lib.php');
if (!strstr($_SERVER['SCRIPT_NAME'], 'install.php')) { if (!strstr($_SERVER['SCRIPT_NAME'], 'install.php')) {
if(!mysql_num_rows(mysql_query(" show tables like '{$g5['sms5_config_table']}' "))) if(!sql_num_rows(sql_query(" show tables like '{$g5['sms5_config_table']}' ")))
goto_url('install.php'); goto_url('install.php');
// SMS 설정값 배열변수 // SMS 설정값 배열변수
+1 -40
View File
@@ -90,49 +90,10 @@ if ($config['cf_sms_use'] == 'icode') { // 아이코드 사용
<tr> <tr>
<th scope="row"><label for="cf_phone">회신번호<strong class="sound_only"> 필수</strong></label></th> <th scope="row"><label for="cf_phone">회신번호<strong class="sound_only"> 필수</strong></label></th>
<td> <td>
<?php echo help("회신받을 휴대폰 번호를 입력하세요. '-' 를 꼭 입력하세요.<br>예) 010-123-4567"); ?> <?php echo help("회신받을 휴대폰 번호를 입력하세요. 회신번호는 발신번호로 사전등록된 번호와 동일해야 합니다.<br>예) 010-123-4567"); ?>
<input type="text" name="cf_phone" value="<?php echo $sms5['cf_phone']; ?>" id="cf_phone" required class="frm_input required" size="12"> <input type="text" name="cf_phone" value="<?php echo $sms5['cf_phone']; ?>" id="cf_phone" required class="frm_input required" size="12">
</td> </td>
</tr> </tr>
<tr>
<th scope="row"><label for="cf_member">회원간 문자전송</label></th>
<td>
<?php echo help("허용에 체크하면 회원끼리 문자전송이 가능합니다.");?>
<input type="checkbox" name="cf_member" value="1" id="cf_member" <?php echo get_checked(1, $sms5['cf_member']); ?>> <label for="cf_member">허용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="cf_level">문자전송가능 레벨</label></th>
<td>
<?php echo help("문자전송을 허용할 회원레벨을 선택해주세요.");?>
<select name="cf_level" id="cf_level">
<?php for ($i=1; $i<=10; $i++) { ?>
<option value="<?php echo $i?>"<?php echo get_selected($i, $sms5['cf_level']);?>> <?php echo $i?> </option>
<?php } ?>
</select>
레벨 이상
</td>
</tr>
<tr>
<th scope="row"><label for="cf_point">문자전송 차감 포인트<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("회원이 문자를 전송할시에 차감할 포인트를 입력해주세요. 0이면 포인트를 차감하지 않습니다.");?>
<input type="text" name="cf_point" value="<?php echo $sms5['cf_point']; ?>" id="cf_point" required class="frm_input required" size="5">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_day_count">문자전송 하루제한 갯수<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("회원이 하루에 보낼수 있는 문자 갯수를 입력해주세요. 0이면 제한하지 않습니다.");?>
<input type="text" name="cf_day_count" value="<?php echo $sms5['cf_day_count']; ?>" id="cf_day_count" required class="frm_input required" size="5">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_skin">스킨 디렉토리<strong class="sound_only">필수</strong></label></th>
<td>
<?php echo get_sms5_skin_select('skin', 'cf_skin', 'cf_skin', $sms5['cf_skin'], 'required'); ?>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
+5 -6
View File
@@ -8,16 +8,15 @@ check_demo();
$g5['title'] = "SMS 기본설정"; $g5['title'] = "SMS 기본설정";
// 회신번호 체크
if(!check_vaild_callback($cf_phone))
alert('회신번호가 올바르지 않습니다.');
$userinfo = get_icode_userinfo($cf_icode_id, $cf_icode_pw); $userinfo = get_icode_userinfo($cf_icode_id, $cf_icode_pw);
if ($userinfo['code'] == '202') if ($userinfo['code'] == '202')
alert('아이코드 아이디와 패스워드가 맞지 않습니다.'); alert('아이코드 아이디와 패스워드가 맞지 않습니다.');
if ($cf_member == '1')
$cf_member = 1;
else
$cf_member = 0;
$res = sql_fetch("select * from ".$g5['sms5_config_table']." limit 1"); $res = sql_fetch("select * from ".$g5['sms5_config_table']." limit 1");
if (!$res) if (!$res)
@@ -25,7 +24,7 @@ if (!$res)
else else
$sql = "update "; $sql = "update ";
$sql .= $g5['sms5_config_table']." set cf_phone='$cf_phone', cf_member='$cf_member', cf_level='$cf_level', cf_point='$cf_point', cf_day_count='$cf_day_count', cf_skin = '$cf_skin' "; $sql .= $g5['sms5_config_table']." set cf_phone='$cf_phone' ";
sql_query($sql); sql_query($sql);
-90
View File
@@ -1,90 +0,0 @@
<?php
$sub_menu = "900410";
include_once("./_common.php");
$page_size = 20;
$colspan = 7;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "문자전송 내역 (회원)";
if ($page < 1) $page = 1;
if ($st && trim($sv))
$sql_search = " and $st like '%$sv%' ";
else
$sql_search = "";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_member_history_table']} where 1 $sql_search");
$total_count = $total_res['cnt'];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="search_form" method="get" action="<?php echo $_SEVER['SCRIPT_NAME']?>" class="local_sch01 local_sch">
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="mb_id"<?php echo get_selected('mh_name', $st); ?>>아이디</option>
<option value="mh_hp"<?php echo get_selected('mh_hp', $st); ?>>받는번호</option>
<option value="mh_reply"<?php echo get_selected('mh_reply', $st); ?>>보내는번호</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv ?>" id="sv" required class="required frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">회원</th>
<th scope="col">보내는번호</th>
<th scope="col">받는번호</th>
<th scope="col">전송일시</th>
<th scope="col">예약</th>
<th scope="col">Log</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="empty_table" >
데이터가 없습니다.
</td>
</tr>
<?php
}
$qry = sql_query("select * from {$g5['sms5_member_history_table']} where 1 $sql_search order by mh_no desc limit $page_start, $page_size");
while($row = sql_fetch_array($qry)) {
$bg = 'bg'.($line++%2);
$mb = get_member($row['mb_id']);
$mb_id = get_sideview($row['mb_id'], $mb['mb_nick']);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $vnum--?></td>
<td class="td_mbid"><?php echo $mb_id?></td>
<td class="td_numbig"><?php echo $row['mh_reply']?></td>
<td class="td_numbig"><?php echo $row['mh_hp']?></td>
<td class="td_datetime"><?php echo $row['mh_datetime']?></td>
<td class="td_boolean"><?php echo $row['mh_booking']!='0000-00-00 00:00:00'?"<span title='{$row['mh_booking']}'>예약</span>":'';?></td>
<td><?php echo $row['mh_log']?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['SCRIPT_NAME']."?st=$st&amp;sv=$sv&amp;page="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>
+2 -2
View File
@@ -53,7 +53,7 @@ eval("\$file = \"$file\";");
$f = explode(";", $file); $f = explode(";", $file);
for ($i=0; $i<count($f); $i++) { for ($i=0; $i<count($f); $i++) {
if (trim($f[$i]) == "") continue; if (trim($f[$i]) == "") continue;
mysql_query($f[$i]) or die(mysql_error()); sql_query($f[$i]) or die(mysqli_error());
} }
// 테이블 생성 ------------------------------------ // 테이블 생성 ------------------------------------
@@ -68,7 +68,7 @@ $download_point = -20;
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
// config 테이블 설정 // config 테이블 설정
$sql = " insert into {$g5['sms5_book_group_table']} set bg_name='미분류'"; $sql = " insert into {$g5['sms5_book_group_table']} set bg_name='미분류'";
mysql_query($sql) or die(mysql_error() . "<p>" . $sql); sql_query($sql) or die(mysqli_error() . "<p>" . $sql);
echo "<script>document.getElementById('sms5_job_02').innerHTML='DB설정 완료';</script>"; echo "<script>document.getElementById('sms5_job_02').innerHTML='DB설정 완료';</script>";
flush(); usleep(50000); flush(); usleep(50000);
+1 -28
View File
@@ -65,12 +65,7 @@ DROP TABLE IF EXISTS `{$g5['sms5_config_table']}`;
CREATE TABLE `{$g5['sms5_config_table']}` ( CREATE TABLE `{$g5['sms5_config_table']}` (
`cf_phone` varchar(255) NOT NULL default '', `cf_phone` varchar(255) NOT NULL default '',
`cf_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `cf_datetime` datetime NOT NULL default '0000-00-00 00:00:00'
`cf_member` tinyint(4) NOT NULL default '1',
`cf_level` tinyint(4) NOT NULL default '2',
`cf_point` int(11) NOT NULL default '0',
`cf_day_count` int(11) NOT NULL default '0',
`cf_skin` varchar(100) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -164,25 +159,3 @@ CREATE TABLE `{$g5['sms5_write_table']}` (
`wr_memo` text NOT NULL, `wr_memo` text NOT NULL,
KEY `wr_no` (`wr_no`,`wr_renum`) KEY `wr_no` (`wr_no`,`wr_renum`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_member_history_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_member_history_table']}`;
CREATE TABLE `{$g5['sms5_member_history_table']}` (
`mh_no` int(11) NOT NULL auto_increment,
`mb_id` varchar(30) NOT NULL,
`mh_reply` varchar(30) NOT NULL,
`mh_hp` varchar(30) NOT NULL,
`mh_datetime` datetime NOT NULL,
`mh_booking` datetime NOT NULL,
`mh_log` varchar(255) NOT NULL,
`mh_ip` varchar(15) NOT NULL,
PRIMARY KEY (`mh_no`),
KEY `mb_id` (`mb_id`,`mh_datetime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+3 -3
View File
@@ -114,7 +114,7 @@ if ($config['cf_sms_use'] == 'icode') { // 아이코드 사용
<div id="write_reply"> <div id="write_reply">
<label for="wr_reply">회신<strong class="sound_only"> 필수</strong></label> <label for="wr_reply">회신<strong class="sound_only"> 필수</strong></label>
<input type="text" name="wr_reply" value="<?php echo $sms5['cf_phone']?>" id="wr_reply" required class="frm_input required" size="17" maxlength="20"> <input type="text" name="wr_reply" value="<?php echo $sms5['cf_phone']?>" id="wr_reply" required class="frm_input required" size="17" maxlength="20" readonly="readonly">
</div> </div>
<div id="write_recv" class="write_inner"> <div id="write_recv" class="write_inner">
@@ -532,7 +532,7 @@ if ($wr_no)
// 회원목록 // 회원목록
$sql = " select * from {$g5['sms5_history_table']} where wr_no = '$wr_no' and bk_no > 0 "; $sql = " select * from {$g5['sms5_history_table']} where wr_no = '$wr_no' and bk_no > 0 ";
$qry = sql_query($sql); $qry = sql_query($sql);
$tot = mysql_num_rows($qry); $tot = sql_num_rows($qry);
if ($tot > 0) { if ($tot > 0) {
@@ -550,7 +550,7 @@ if ($wr_no)
// 비회원 목록 // 비회원 목록
$sql = " select * from {$g5['sms5_history_table']} where wr_no = '$wr_no' and bk_no = 0 "; $sql = " select * from {$g5['sms5_history_table']} where wr_no = '$wr_no' and bk_no = 0 ";
$qry = sql_query($sql); $qry = sql_query($sql);
$tot = mysql_num_rows($qry); $tot = sql_num_rows($qry);
if ($tot > 0) if ($tot > 0)
{ {
+12
View File
@@ -12,6 +12,9 @@ $wr_message = clean_xss_tags(trim($wr_message));
if (!$wr_reply) if (!$wr_reply)
win_close_alert('회신 번호를 숫자, - 로 입력해주세요.'); win_close_alert('회신 번호를 숫자, - 로 입력해주세요.');
if(!check_vaild_callback($wr_reply))
win_close_alert('회신 번호를 올바르게 입력해 주십시오.');
if (!$wr_message) if (!$wr_message)
win_close_alert('메세지를 입력해주세요.'); win_close_alert('메세지를 입력해주세요.');
@@ -42,6 +45,9 @@ while ($row = array_shift($send_list))
while ($row = sql_fetch_array($qry)) while ($row = sql_fetch_array($qry))
{ {
$row['bk_hp'] = get_hp($row['bk_hp'], 0); $row['bk_hp'] = get_hp($row['bk_hp'], 0);
if(!$row['bk_hp']) continue;
if ($wr_overlap && array_overlap($hps, $row['bk_hp'])) { if ($wr_overlap && array_overlap($hps, $row['bk_hp'])) {
$overlap++; $overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] ); array_push( $duplicate_data['hp'], $row['bk_hp'] );
@@ -63,6 +69,8 @@ while ($row = array_shift($send_list))
$hp = get_hp($row['mb_hp'], 0); $hp = get_hp($row['mb_hp'], 0);
$mb_id = $row['mb_id']; $mb_id = $row['mb_id'];
if(!$hp) continue;
if ($wr_overlap && array_overlap($hps, $hp)) { if ($wr_overlap && array_overlap($hps, $hp)) {
$overlap++; $overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] ); array_push( $duplicate_data['hp'], $row['bk_hp'] );
@@ -84,6 +92,8 @@ while ($row = array_shift($send_list))
$hp = get_hp($item[$i][1], 0); $hp = get_hp($item[$i][1], 0);
$name = $item[$i][0]; $name = $item[$i][0];
if(!$hp) continue;
if ($wr_overlap && array_overlap($hps, $hp)) { if ($wr_overlap && array_overlap($hps, $hp)) {
$overlap++; $overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] ); array_push( $duplicate_data['hp'], $row['bk_hp'] );
@@ -99,6 +109,8 @@ while ($row = array_shift($send_list))
$row = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$item[$i]'"); $row = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$item[$i]'");
$row['bk_hp'] = get_hp($row['bk_hp'], 0); $row['bk_hp'] = get_hp($row['bk_hp'], 0);
if(!$row['bk_hp']) continue;
if ($wr_overlap && array_overlap($hps, $row['bk_hp'])) { if ($wr_overlap && array_overlap($hps, $row['bk_hp'])) {
$overlap++; $overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] ); array_push( $duplicate_data['hp'], $row['bk_hp'] );
+1 -1
View File
@@ -53,7 +53,7 @@ if ($sca || $stx) {
/* /*
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} "; $sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
$result = sql_query($sql); $result = sql_query($sql);
$total_count = mysql_num_rows($result); $total_count = sql_num_rows($result);
*/ */
} else { } else {
$sql_search = ""; $sql_search = "";
+1 -1
View File
@@ -99,7 +99,7 @@ while ($row = sql_fetch_array($result))
wr_10 = '".addslashes($row2['wr_10'])."' "; wr_10 = '".addslashes($row2['wr_10'])."' ";
sql_query($sql); sql_query($sql);
$insert_id = mysql_insert_id(); $insert_id = sql_insert_id();
// 코멘트가 아니라면 // 코멘트가 아니라면
if (!$row2['wr_is_comment']) if (!$row2['wr_is_comment'])
+1 -1
View File
@@ -244,7 +244,7 @@ if($w == '' || $w == 'a' || $w == 'r') {
sql_query($sql); sql_query($sql);
if($w == '' || $w == 'r') { if($w == '' || $w == 'r') {
$qa_id = mysql_insert_id(); $qa_id = sql_insert_id();
if($w == 'r' && $write['qa_related']) { if($w == 'r' && $write['qa_related']) {
$qa_related = $write['qa_related']; $qa_related = $write['qa_related'];
+11 -11
View File
@@ -62,6 +62,17 @@ $mb_8 = isset($_POST['mb_8']) ? trim($_POST['mb_8'])
$mb_9 = isset($_POST['mb_9']) ? trim($_POST['mb_9']) : ""; $mb_9 = isset($_POST['mb_9']) ? trim($_POST['mb_9']) : "";
$mb_10 = isset($_POST['mb_10']) ? trim($_POST['mb_10']) : ""; $mb_10 = isset($_POST['mb_10']) ? trim($_POST['mb_10']) : "";
$mb_name = clean_xss_tags($mb_name);
$mb_email = get_email_address($mb_email);
$mb_homepage = clean_xss_tags($mb_homepage);
$mb_tel = clean_xss_tags($mb_tel);
$mb_zip1 = preg_replace('/[^0-9]/', '', $mb_zip1);
$mb_zip2 = preg_replace('/[^0-9]/', '', $mb_zip2);
$mb_addr1 = clean_xss_tags($mb_addr1);
$mb_addr2 = clean_xss_tags($mb_addr2);
$mb_addr3 = clean_xss_tags($mb_addr3);
$mb_addr_jibeon = preg_match("/^(N|R)$/", $mb_addr_jibeon) ? $mb_addr_jibeon : '';
if ($w == '' || $w == 'u') { if ($w == '' || $w == 'u') {
if ($msg = empty_mb_id($mb_id)) alert($msg, "", true, true); // alert($msg, $url, $error, $post); if ($msg = empty_mb_id($mb_id)) alert($msg, "", true, true); // alert($msg, $url, $error, $post);
@@ -119,17 +130,6 @@ if ($w == '' || $w == 'u') {
if ($msg = exist_mb_email($mb_email, $mb_id)) alert($msg, "", true, true); if ($msg = exist_mb_email($mb_email, $mb_id)) alert($msg, "", true, true);
} }
$mb_name = clean_xss_tags($mb_name);
$mb_email = get_email_address($mb_email);
$mb_homepage = clean_xss_tags($mb_homepage);
$mb_tel = clean_xss_tags($mb_tel);
$mb_zip1 = preg_replace('/[^0-9]/', '', $mb_zip1);
$mb_zip2 = preg_replace('/[^0-9]/', '', $mb_zip2);
$mb_addr1 = clean_xss_tags($mb_addr1);
$mb_addr2 = clean_xss_tags($mb_addr2);
$mb_addr3 = clean_xss_tags($mb_addr3);
$mb_addr_jibeon = preg_match("/^(N|R)$/", $mb_addr_jibeon) ? $mb_addr_jibeon : '';
// 사용자 코드 실행 // 사용자 코드 실행
@include_once($member_skin_path.'/register_form_update.head.skin.php'); @include_once($member_skin_path.'/register_form_update.head.skin.php');
+1 -1
View File
@@ -70,7 +70,7 @@ if ($wr_content && ($member['mb_level'] >= $board['bo_comment_level']))
wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql); sql_query($sql);
$comment_id = mysql_insert_id(); $comment_id = sql_insert_id();
// 원글에 코멘트수 증가 // 원글에 코멘트수 증가
sql_query(" update $write_table set wr_comment = wr_comment + 1 where wr_id = '$wr_id' "); sql_query(" update $write_table set wr_comment = wr_comment + 1 where wr_id = '$wr_id' ");
+1 -1
View File
@@ -120,7 +120,7 @@ if ($stx) {
$sql = " select wr_id from {$tmp_write_table} where {$sql_search} "; $sql = " select wr_id from {$tmp_write_table} where {$sql_search} ";
$result = sql_query($sql, false); $result = sql_query($sql, false);
$row['cnt'] = @mysql_num_rows($result); $row['cnt'] = @sql_num_rows($result);
$total_count += $row['cnt']; $total_count += $row['cnt'];
if ($row['cnt']) { if ($row['cnt']) {
+1 -1
View File
@@ -12,7 +12,7 @@ switch($_REQUEST['sns']) {
header("Location:http://www.facebook.com/sharer/sharer.php?s=100&u=".$short_url."&p=".$title); header("Location:http://www.facebook.com/sharer/sharer.php?s=100&u=".$short_url."&p=".$title);
break; break;
case 'twitter' : case 'twitter' :
header("Location:http://twitter.com/home?status=".$title_url); header("Location:https://twitter.com/intent/tweet?text=".$title_url);
break; break;
case 'gplus' : case 'gplus' :
header("Location:https://plus.google.com/share?url=".$short_url); header("Location:https://plus.google.com/share?url=".$short_url);
+1 -1
View File
@@ -167,7 +167,7 @@ if ($w == 'c') // 댓글 입력
wr_10 = '$wr_10' "; wr_10 = '$wr_10' ";
sql_query($sql); sql_query($sql);
$comment_id = mysql_insert_id(); $comment_id = sql_insert_id();
// 원글에 댓글수 증가 & 마지막 시간 반영 // 원글에 댓글수 증가 & 마지막 시간 반영
sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '".G5_TIME_YMDHIS."' where wr_id = '$wr_id' "); sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '".G5_TIME_YMDHIS."' where wr_id = '$wr_id' ");
+1 -1
View File
@@ -244,7 +244,7 @@ if ($w == '' || $w == 'r') {
wr_10 = '$wr_10' "; wr_10 = '$wr_10' ";
sql_query($sql); sql_query($sql);
$wr_id = mysql_insert_id(); $wr_id = sql_insert_id();
// 부모 아이디에 UPDATE // 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
+1 -1
View File
@@ -135,7 +135,7 @@ if (file_exists($dbconfig_file)) {
// mysql connect resource $g5 배열에 저장 - 명랑폐인님 제안 // mysql connect resource $g5 배열에 저장 - 명랑폐인님 제안
$g5['connect_db'] = $connect_db; $g5['connect_db'] = $connect_db;
sql_query(" set names utf8 "); sql_set_charset('utf8', $connect_db);
if(defined('G5_MYSQL_SET_MODE') && G5_MYSQL_SET_MODE) sql_query("SET SESSION sql_mode = ''"); if(defined('G5_MYSQL_SET_MODE') && G5_MYSQL_SET_MODE) sql_query("SET SESSION sql_mode = ''");
if (defined(G5_TIMEZONE)) sql_query(" set time_zone = '".G5_TIMEZONE."'"); if (defined(G5_TIMEZONE)) sql_query(" set time_zone = '".G5_TIMEZONE."'");
} else { } else {
+4 -1
View File
@@ -5,7 +5,7 @@
********************/ ********************/
define('G5_VERSION', '그누보드5'); define('G5_VERSION', '그누보드5');
define('G5_GNUBOARD_VER', '5.1.2'); define('G5_GNUBOARD_VER', '5.1.4');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음 // 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true); define('_GNUBOARD_', true);
@@ -195,6 +195,9 @@ define('G5_THUMB_PNG_COMPRESS', 5);
// 모바일 기기에서 DHTML 에디터 사용여부를 설정합니다. // 모바일 기기에서 DHTML 에디터 사용여부를 설정합니다.
define('G5_IS_MOBILE_DHTML_USE', false); define('G5_IS_MOBILE_DHTML_USE', false);
// MySQLi 사용여부를 설정합니다.
define('G5_MYSQLI_USE', true);
// ip 숨김방법 설정 // ip 숨김방법 설정
/* 123.456.789.012 ip의 숨김 방법을 변경하는 방법은 /* 123.456.789.012 ip의 숨김 방법을 변경하는 방법은
\\1 은 123, \\2는 456, \\3은 789, \\4는 012에 각각 대응되므로 \\1 은 123, \\2는 456, \\3은 789, \\4는 012에 각각 대응되므로
-13
View File
@@ -22,23 +22,10 @@ $g5['sms5_book_table'] = $g5['sms5_prefix'] . 'book';
$g5['sms5_book_group_table'] = $g5['sms5_prefix'] . 'book_group'; $g5['sms5_book_group_table'] = $g5['sms5_prefix'] . 'book_group';
$g5['sms5_form_table'] = $g5['sms5_prefix'] . 'form'; $g5['sms5_form_table'] = $g5['sms5_prefix'] . 'form';
$g5['sms5_form_group_table'] = $g5['sms5_prefix'] . 'form_group'; $g5['sms5_form_group_table'] = $g5['sms5_prefix'] . 'form_group';
$g5['sms5_member_history_table'] = $g5['sms5_prefix'] . 'member_history';
if (!empty($config['cf_sms_use'])) { if (!empty($config['cf_sms_use'])) {
$sms5 = sql_fetch("select * from {$g5['sms5_config_table']} ", false); $sms5 = sql_fetch("select * from {$g5['sms5_config_table']} ", false);
if( $sms5['cf_member'] && trim($member['mb_hp']) ) {
$g5['sms5_use_sideview'] = true; //회원 사이드뷰 레이어에 추가
} else {
$g5['sms5_use_sideview'] = false;
}
//==============================================================================
// 스킨경로
//------------------------------------------------------------------------------
$sms5_skin_path = G5_SMS5_PATH.'/skin/'.$sms5['cf_skin']; //sms5 스킨 path
$sms5_skin_url = G5_SMS5_URL .'/skin/'.$sms5['cf_skin']; //sms5 스킨 url
// Demo 설정 // Demo 설정
if (file_exists(G5_PATH.'/DEMO')) if (file_exists(G5_PATH.'/DEMO'))
+5 -35
View File
@@ -169,13 +169,7 @@ document.onkeydown = noRefresh ;
$is_euckr = true; $is_euckr = true;
// member table 복사 // member table 복사
$columns = array(); $columns = sql_field_names($g5['member_table']);
$fields = mysql_list_fields(G5_MYSQL_DB, $g5['member_table']);
$count = mysql_num_fields($fields);
for ($i = 0; $i < $count; $i++) {
$fld = mysql_field_name($fields, $i);
$columns[] = $fld;
}
$sql = " select * from {$g4['member_table']} "; $sql = " select * from {$g4['member_table']} ";
$result = sql_query($sql); $result = sql_query($sql);
@@ -325,13 +319,7 @@ document.onkeydown = noRefresh ;
echo '<li>visit sum table 복사</li>'.PHP_EOL; echo '<li>visit sum table 복사</li>'.PHP_EOL;
// group table 복사 // group table 복사
$columns = array(); $columns = sql_field_names($g5['group_table']);
$fields = mysql_list_fields(G5_MYSQL_DB, $g5['group_table']);
$count = mysql_num_fields($fields);
for ($i = 0; $i < $count; $i++) {
$fld = mysql_field_name($fields, $i);
$columns[] = $fld;
}
$sql = " select * from {$g4['group_table']} "; $sql = " select * from {$g4['group_table']} ";
$result = sql_query($sql); $result = sql_query($sql);
@@ -365,13 +353,7 @@ document.onkeydown = noRefresh ;
unset($fiels); unset($fiels);
// board 복사 // board 복사
$columns = array(); $columns = sql_field_names($g5['board_table']);
$fields = mysql_list_fields(G5_MYSQL_DB, $g5['board_table']);
$count = mysql_num_fields($fields);
for ($i = 0; $i < $count; $i++) {
$fld = mysql_field_name($fields, $i);
$columns[] = $fld;
}
$sql = " select * from {$g4['board_table']} "; $sql = " select * from {$g4['board_table']} ";
$result = sql_query($sql); $result = sql_query($sql);
@@ -413,13 +395,7 @@ document.onkeydown = noRefresh ;
// 게시글 복사 // 게시글 복사
if(sql_query($sql, FALSE)) { if(sql_query($sql, FALSE)) {
$write_table = $g4['write_prefix'].$bo_table; $write_table = $g4['write_prefix'].$bo_table;
$columns2 = array(); $columns2 = sql_field_names($create_table);
$fields2 = mysql_list_fields(G5_MYSQL_DB, $create_table);
$count2 = mysql_num_fields($fields2);
for ($j = 0; $j < $count2; $j++) {
$fld = mysql_field_name($fields2, $j);
$columns2[] = $fld;
}
$sql3 = " select * from $write_table "; $sql3 = " select * from $write_table ";
$result3 = sql_query($sql3); $result3 = sql_query($sql3);
@@ -461,13 +437,7 @@ document.onkeydown = noRefresh ;
$tables = array('board_file', 'board_new', 'board_good', 'mail', 'memo', 'group_member', 'auth', 'popular', 'poll', 'poll_etc', 'scrap'); $tables = array('board_file', 'board_new', 'board_good', 'mail', 'memo', 'group_member', 'auth', 'popular', 'poll', 'poll_etc', 'scrap');
foreach($tables as $table) { foreach($tables as $table) {
$columns = array(); $columns = sql_field_names($g5[$table.'_table']);
$fields = mysql_list_fields(G5_MYSQL_DB, $g5[$table.'_table']);
$count = mysql_num_fields($fields);
for ($i = 0; $i < $count; $i++) {
$fld = mysql_field_name($fields, $i);
$columns[] = $fld;
}
$src_table = $g4[$table.'_table']; $src_table = $g4[$table.'_table'];
$dst_table = $g5[$table.'_table']; $dst_table = $g5[$table.'_table'];
+17 -13
View File
@@ -8,6 +8,8 @@ header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0 header('Pragma: no-cache'); // HTTP/1.0
include_once ('../config.php'); include_once ('../config.php');
include_once ('../lib/common.lib.php');
$title = G5_VERSION." 설치 완료 3/3"; $title = G5_VERSION." 설치 완료 3/3";
include_once ('./install.inc.php'); include_once ('./install.inc.php');
@@ -23,7 +25,7 @@ $admin_pass = $_POST['admin_pass'];
$admin_name = $_POST['admin_name']; $admin_name = $_POST['admin_name'];
$admin_email = $_POST['admin_email']; $admin_email = $_POST['admin_email'];
$dblink = @mysql_connect($mysql_host, $mysql_user, $mysql_pass); $dblink = sql_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
if (!$dblink) { if (!$dblink) {
?> ?>
@@ -37,7 +39,7 @@ if (!$dblink) {
exit; exit;
} }
$select_db = @mysql_select_db($mysql_db, $dblink); $select_db = sql_select_db($mysql_db, $dblink);
if (!$select_db) { if (!$select_db) {
?> ?>
@@ -52,12 +54,14 @@ if (!$select_db) {
} }
$mysql_set_mode = 'false'; $mysql_set_mode = 'false';
@mysql_query('set names utf8'); sql_set_charset('utf8', $dblink);
$row = mysql_fetch_assoc(mysql_query(" SELECT @@sql_mode as mode ")); $result = sql_query(" SELECT @@sql_mode as mode ", true, $dblink);
$row = sql_fetch_array($result);
if($row['mode']) { if($row['mode']) {
@mysql_query("SET SESSION sql_mode = ''"); sql_query("SET SESSION sql_mode = ''", true, $dblink);
$mysql_set_mode = 'true'; $mysql_set_mode = 'true';
} }
unset($result);
unset($row); unset($row);
?> ?>
@@ -75,7 +79,7 @@ $file = preg_replace('/`g5_([^`]+`)/', '`'.$table_prefix.'$1', $file);
$f = explode(';', $file); $f = explode(';', $file);
for ($i=0; $i<count($f); $i++) { for ($i=0; $i<count($f); $i++) {
if (trim($f[$i]) == '') continue; if (trim($f[$i]) == '') continue;
mysql_query($f[$i]) or die(mysql_error()); sql_query($f[$i], true, $dblink);
} }
// 테이블 생성 ------------------------------------ // 테이블 생성 ------------------------------------
?> ?>
@@ -154,14 +158,14 @@ $sql = " insert into `{$table_prefix}config`
cf_stipulation = '해당 홈페이지에 맞는 회원가입약관을 입력합니다.', cf_stipulation = '해당 홈페이지에 맞는 회원가입약관을 입력합니다.',
cf_privacy = '해당 홈페이지에 맞는 개인정보처리방침을 입력합니다.' cf_privacy = '해당 홈페이지에 맞는 개인정보처리방침을 입력합니다.'
"; ";
mysql_query($sql) or die(mysql_error() . "<p>" . $sql); sql_query($sql, true, $dblink);
// 1:1문의 설정 // 1:1문의 설정
$sql = " insert into `{$table_prefix}qa_config` $sql = " insert into `{$table_prefix}qa_config`
( qa_title, qa_category, qa_skin, qa_mobile_skin, qa_use_email, qa_req_email, qa_use_hp, qa_req_hp, qa_use_editor, qa_subject_len, qa_mobile_subject_len, qa_page_rows, qa_mobile_page_rows, qa_image_width, qa_upload_size, qa_insert_content ) ( qa_title, qa_category, qa_skin, qa_mobile_skin, qa_use_email, qa_req_email, qa_use_hp, qa_req_hp, qa_use_editor, qa_subject_len, qa_mobile_subject_len, qa_page_rows, qa_mobile_page_rows, qa_image_width, qa_upload_size, qa_insert_content )
values values
( '1:1문의', '회원|포인트', 'basic', 'basic', '1', '0', '1', '0', '1', '60', '30', '15', '15', '600', '1048576', '' ) "; ( '1:1문의', '회원|포인트', 'basic', 'basic', '1', '0', '1', '0', '1', '60', '30', '15', '15', '600', '1048576', '' ) ";
mysql_query($sql); sql_query($sql, true, $dblink);
// 관리자 회원가입 // 관리자 회원가입
$sql = " insert into `{$table_prefix}member` $sql = " insert into `{$table_prefix}member`
@@ -177,15 +181,15 @@ $sql = " insert into `{$table_prefix}member`
mb_datetime = '".G5_TIME_YMDHIS."', mb_datetime = '".G5_TIME_YMDHIS."',
mb_ip = '{$_SERVER['REMOTE_ADDR']}' mb_ip = '{$_SERVER['REMOTE_ADDR']}'
"; ";
@mysql_query($sql); sql_query($sql, true, $dblink);
// 내용관리 생성 // 내용관리 생성
@mysql_query(" insert into `{$table_prefix}content` set co_id = 'company', co_html = '1', co_subject = '회사소개', co_content= '<p align=center><b>회사소개에 대한 내용을 입력하십시오.</b></p>' ") or die(mysql_error() . "<p>" . $sql); sql_query(" insert into `{$table_prefix}content` set co_id = 'company', co_html = '1', co_subject = '회사소개', co_content= '<p align=center><b>회사소개에 대한 내용을 입력하십시오.</b></p>' ", true, $dblink);
@mysql_query(" insert into `{$table_prefix}content` set co_id = 'privacy', co_html = '1', co_subject = '개인정보 처리방침', co_content= '<p align=center><b>개인정보 처리방침에 대한 내용을 입력하십시오.</b></p>' ") or die(mysql_error() . "<p>" . $sql); sql_query(" insert into `{$table_prefix}content` set co_id = 'privacy', co_html = '1', co_subject = '개인정보 처리방침', co_content= '<p align=center><b>개인정보 처리방침에 대한 내용을 입력하십시오.</b></p>' ", true, $dblink);
@mysql_query(" insert into `{$table_prefix}content` set co_id = 'provision', co_html = '1', co_subject = '서비스 이용약관', co_content= '<p align=center><b>서비스 이용약관에 대한 내용을 입력하십시오.</b></p>' ") or die(mysql_error() . "<p>" . $sql); sql_query(" insert into `{$table_prefix}content` set co_id = 'provision', co_html = '1', co_subject = '서비스 이용약관', co_content= '<p align=center><b>서비스 이용약관에 대한 내용을 입력하십시오.</b></p>' ", true, $dblink);
// FAQ Master // FAQ Master
@mysql_query(" insert into `{$table_prefix}faq_master` set fm_id = '1', fm_subject = '자주하시는 질문' ") or die(mysql_error() . "<p>" . $sql); sql_query(" insert into `{$table_prefix}faq_master` set fm_id = '1', fm_subject = '자주하시는 질문' ", true, $dblink);
?> ?>
<li>DB설정 완료</li> <li>DB설정 완료</li>
-13
View File
@@ -503,14 +503,6 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
} }
} }
/**
* sms5 창
**/
var win_sms5 = function(href) {
var new_win = window.open(href, 'win_sms5', 'width=474, height=560, scrollbars=1');
new_win.focus();
}
/** /**
* 새로운 비밀번호 분실 창 : 101123 * 새로운 비밀번호 분실 창 : 101123
**/ **/
@@ -590,11 +582,6 @@ $(function(){
return false; return false;
}); });
$(".win_sms5").click(function() {
win_sms5(this.href);
return false;
});
/* /*
$(".win_poll").click(function() { $(".win_poll").click(function() {
win_poll(this.href); win_poll(this.href);
+169 -24
View File
@@ -562,8 +562,9 @@ function html_purifier($html)
$config = HTMLPurifier_Config::createDefault(); $config = HTMLPurifier_Config::createDefault();
// data/cache 디렉토리에 CSS, HTML, URI 디렉토리 등을 만든다. // data/cache 디렉토리에 CSS, HTML, URI 디렉토리 등을 만든다.
$config->set('Cache.SerializerPath', G5_DATA_PATH.'/cache'); $config->set('Cache.SerializerPath', G5_DATA_PATH.'/cache');
$config->set('HTML.SafeEmbed', true); $config->set('HTML.SafeEmbed', false);
$config->set('HTML.SafeObject', true); $config->set('HTML.SafeObject', false);
$config->set('Output.FlashCompat', false);
$config->set('HTML.SafeIframe', true); $config->set('HTML.SafeIframe', true);
$config->set('URI.SafeIframeRegexp','%^(https?:)?//('.$safeiframe.')%'); $config->set('URI.SafeIframeRegexp','%^(https?:)?//('.$safeiframe.')%');
$config->set('Attr.AllowedFrameTargets', array('_blank')); $config->set('Attr.AllowedFrameTargets', array('_blank'));
@@ -1260,10 +1261,6 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
} }
if($mb_id) if($mb_id)
$str2 .= "<a href=\"".G5_BBS_URL."/new.php?mb_id=".$mb_id."\">전체게시물</a>\n"; $str2 .= "<a href=\"".G5_BBS_URL."/new.php?mb_id=".$mb_id."\">전체게시물</a>\n";
if($g5['sms5_use_sideview']){
$mb = get_member($mb_id, " mb_open, mb_sms , mb_hp ");
if( $mb['mb_open'] && $mb['mb_sms'] && $mb['mb_hp'] ) $str2 .= "<a href=\"".G5_SMS5_URL."/?mb_id=".$mb_id."\" class=\"win_sms5\" target=\"_blank\">문자보내기</a>\n";
}
if($is_admin == "super" && $mb_id) { if($is_admin == "super" && $mb_id) {
$str2 .= "<a href=\"".G5_ADMIN_URL."/member_form.php?w=u&amp;mb_id=".$mb_id."\" target=\"_blank\">회원정보변경</a>\n"; $str2 .= "<a href=\"".G5_ADMIN_URL."/member_form.php?w=u&amp;mb_id=".$mb_id."\" target=\"_blank\">회원정보변경</a>\n";
$str2 .= "<a href=\"".G5_ADMIN_URL."/point_list.php?sfl=mb_id&amp;stx=".$mb_id."\" target=\"_blank\">포인트내역</a>\n"; $str2 .= "<a href=\"".G5_ADMIN_URL."/point_list.php?sfl=mb_id&amp;stx=".$mb_id."\" target=\"_blank\">포인트내역</a>\n";
@@ -1416,11 +1413,22 @@ function html_symbol($str)
*************************************************************************/ *************************************************************************/
// DB 연결 // DB 연결
function sql_connect($host, $user, $pass) function sql_connect($host, $user, $pass, $db=G5_MYSQL_DB)
{ {
global $g5; global $g5;
return @mysql_connect($host, $user, $pass); if(function_exists('mysqli_connect') && G5_MYSQLI_USE) {
$link = mysqli_connect($host, $user, $pass, $db);
// 연결 오류 발생 시 스크립트 종료
if (mysqli_connect_errno()) {
die('Connect Error: '.mysqli_connect_error());
}
} else {
$link = mysql_connect($host, $user, $pass);
}
return $link;
} }
@@ -1429,16 +1437,36 @@ function sql_select_db($db, $connect)
{ {
global $g5; global $g5;
return @mysql_select_db($db, $connect); if(function_exists('mysqli_select_db') && G5_MYSQLI_USE)
return @mysqli_select_db($connect, $db);
else
return @mysql_select_db($db, $connect);
} }
// mysql_query 와 mysql_error 를 한꺼번에 처리 function sql_set_charset($charset, $link=null)
// mysql connect resource 지정 - 명랑폐인님 제안
function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR)
{ {
global $g5; global $g5;
if(!$link)
$link = $g5['connect_db'];
if(function_exists('mysqli_set_charset') && G5_MYSQLI_USE)
mysqli_set_charset($link, $charset);
else
sql_query(" set names {$charset} ");
}
// mysqli_query 와 mysqli_error 를 한꺼번에 처리
// mysql connect resource 지정 - 명랑폐인님 제안
function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
{
global $g5;
if(!$link)
$link = $g5['connect_db'];
// Blind SQL Injection 취약점 해결 // Blind SQL Injection 취약점 해결
$sql = trim($sql); $sql = trim($sql);
// union의 사용을 허락하지 않습니다. // union의 사용을 허락하지 않습니다.
@@ -1447,20 +1475,34 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR)
// `information_schema` DB로의 접근을 허락하지 않습니다. // `information_schema` DB로의 접근을 허락하지 않습니다.
$sql = preg_replace("#^select.*from.*where.*`?information_schema`?.*#i", "select 1", $sql); $sql = preg_replace("#^select.*from.*where.*`?information_schema`?.*#i", "select 1", $sql);
if ($error) if(function_exists('mysqli_query') && G5_MYSQLI_USE) {
$result = @mysql_query($sql, $g5['connect_db']) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : {$_SERVER['SCRIPT_NAME']}"); if ($error) {
else $result = @mysqli_query($link, $sql) or die("<p>$sql<p>" . mysqli_errno($link) . " : " . mysqli_error($link) . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
$result = @mysql_query($sql, $g5['connect_db']); } else {
$result = @mysqli_query($link, $sql);
}
} else {
if ($error) {
$result = @mysql_query($sql, $link) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
} else {
$result = @mysql_query($sql, $link);
}
}
return $result; return $result;
} }
// 쿼리를 실행한 후 결과값에서 한행을 얻는다. // 쿼리를 실행한 후 결과값에서 한행을 얻는다.
function sql_fetch($sql, $error=G5_DISPLAY_SQL_ERROR) function sql_fetch($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
{ {
$result = sql_query($sql, $error); global $g5;
//$row = @sql_fetch_array($result) or die("<p>$sql<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : $_SERVER['SCRIPT_NAME']");
if(!$link)
$link = $g5['connect_db'];
$result = sql_query($sql, $error, $link);
//$row = @sql_fetch_array($result) or die("<p>$sql<p>" . mysqli_errno() . " : " . mysqli_error() . "<p>error file : $_SERVER['SCRIPT_NAME']");
$row = sql_fetch_array($result); $row = sql_fetch_array($result);
return $row; return $row;
} }
@@ -1469,7 +1511,11 @@ function sql_fetch($sql, $error=G5_DISPLAY_SQL_ERROR)
// 결과값에서 한행 연관배열(이름으로)로 얻는다. // 결과값에서 한행 연관배열(이름으로)로 얻는다.
function sql_fetch_array($result) function sql_fetch_array($result)
{ {
$row = @mysql_fetch_assoc($result); if(function_exists('mysqli_fetch_assoc') && G5_MYSQLI_USE)
$row = @mysqli_fetch_assoc($result);
else
$row = @mysql_fetch_assoc($result);
return $row; return $row;
} }
@@ -1479,7 +1525,10 @@ function sql_fetch_array($result)
// 단, 결과 값은 스크립트(script) 실행부가 종료되면서 메모리에서 자동적으로 지워진다. // 단, 결과 값은 스크립트(script) 실행부가 종료되면서 메모리에서 자동적으로 지워진다.
function sql_free_result($result) function sql_free_result($result)
{ {
return mysql_free_result($result); if(function_exists('mysqli_free_result') && G5_MYSQLI_USE)
return mysqli_free_result($result);
else
return mysql_free_result($result);
} }
@@ -1493,6 +1542,74 @@ function sql_password($value)
} }
function sql_insert_id($link=null)
{
global $g5;
if(!$link)
$link = $g5['connect_db'];
if(function_exists('mysqli_insert_id') && G5_MYSQLI_USE)
return mysqli_insert_id($link);
else
return mysql_insert_id($link);
}
function sql_num_rows($result)
{
if(function_exists('mysqli_num_rows') && G5_MYSQLI_USE)
return mysqli_num_rows($result);
else
return mysql_num_rows($result);
}
function sql_field_names($table, $link=null)
{
global $g5;
if(!$link)
$link = $g5['connect_db'];
$columns = array();
$sql = " select * from `$table` limit 1 ";
$result = sql_query($sql, $link);
if(function_exists('mysqli_fetch_field') && G5_MYSQLI_USE) {
while($field = mysqli_fetch_field($result)) {
$columns[] = $field->name;
}
} else {
$i = 0;
$cnt = mysql_num_fields($result);
while($i < $cnt) {
$field = mysql_fetch_field($result, $i);
$columns[] = $field->name;
$i++;
}
}
return $columns;
}
function sql_error_info($link=null)
{
global $g5;
if(!$link)
$link = $g5['connect_db'];
if(function_exists('mysqli_error') && G5_MYSQLI_USE) {
return mysqli_errno($link) . ' : ' . mysqli_error($link);
} else {
return mysql_errno($link) . ' : ' . mysql_error($link);
}
}
// PHPMyAdmin 참고 // PHPMyAdmin 참고
function get_table_define($table, $crlf="\n") function get_table_define($table, $crlf="\n")
{ {
@@ -1893,12 +2010,15 @@ function convert_charset($from_charset, $to_charset, $str)
} }
// mysql_real_escape_string 의 alias 기능을 한다. // mysqli_real_escape_string 의 alias 기능을 한다.
function sql_real_escape_string($field) function sql_real_escape_string($str, $link=null)
{ {
global $g5; global $g5;
return mysql_real_escape_string($field, $g5['connect_db']); if(!$link)
$link = $g5['connect_db'];
return mysqli_real_escape_string($link, $str);
} }
function escape_trim($field) function escape_trim($field)
@@ -3017,4 +3137,29 @@ function get_skin_url($dir, $skin)
return str_replace(G5_PATH, G5_URL, $skin_path); return str_replace(G5_PATH, G5_URL, $skin_path);
} }
// 발신번호 유효성 체크
function check_vaild_callback($callback){
$_callback = preg_replace('/[^0-9]/','', $callback);
/**
* 1588 로시작하면 총8자리인데 7자리라 차단
* 02 로시작하면 총9자리 또는 10자리인데 11자리라차단
* 1366은 그자체가 원번호이기에 다른게 붙으면 차단
* 030으로 시작하면 총10자리 또는 11자리인데 9자리라차단
*/
if( substr($_callback,0,4) == '1588') if( strlen($_callback) != 8) return false;
if( substr($_callback,0,2) == '02') if( strlen($_callback) != 9 && strlen($_callback) != 10 ) return false;
if( substr($_callback,0,3) == '030') if( strlen($_callback) != 10 && strlen($_callback) != 11 ) return false;
if( !preg_match("/^(02|0[3-6]\d|01(0|1|3|5|6|7|8|9)|070|080|007)\-?\d{3,4}\-?\d{4,5}$/",$_callback) &&
!preg_match("/^(15|16|18)\d{2}\-?\d{4,5}$/",$_callback) ){
return false;
} else if( preg_match("/^(02|0[3-6]\d|01(0|1|3|5|6|7|8|9)|070|080)\-?0{3,4}\-?\d{4}$/",$_callback )) {
return false;
} else {
return true;
}
}
?> ?>
+1 -1
View File
@@ -474,7 +474,7 @@ and the roundoff errors in the Gaussian blur process, are welcome.
$radius = abs(round($radius)); // Only integers make sense. $radius = abs(round($radius)); // Only integers make sense.
if ($radius == 0) { if ($radius == 0) {
return $img; imagedestroy($img); break; } return $img; imagedestroy($img); }
$w = imagesx($img); $h = imagesy($img); $w = imagesx($img); $h = imagesy($img);
$imgCanvas = imagecreatetruecolor($w, $h); $imgCanvas = imagecreatetruecolor($w, $h);
$imgBlur = imagecreatetruecolor($w, $h); $imgBlur = imagecreatetruecolor($w, $h);
File diff suppressed because it is too large Load Diff
@@ -1,44 +1,48 @@
<?php <?php
/** /**
* Converts HTMLPurifier_ConfigSchema_Interchange to our runtime * Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
* representation used to perform checks on user configuration. * representation used to perform checks on user configuration.
*/ */
class HTMLPurifier_ConfigSchema_Builder_ConfigSchema class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
{ {
public function build($interchange) { /**
$schema = new HTMLPurifier_ConfigSchema(); * @param HTMLPurifier_ConfigSchema_Interchange $interchange
foreach ($interchange->directives as $d) { * @return HTMLPurifier_ConfigSchema
$schema->add( */
$d->id->key, public function build($interchange)
$d->default, {
$d->type, $schema = new HTMLPurifier_ConfigSchema();
$d->typeAllowsNull foreach ($interchange->directives as $d) {
); $schema->add(
if ($d->allowed !== null) { $d->id->key,
$schema->addAllowedValues( $d->default,
$d->id->key, $d->type,
$d->allowed $d->typeAllowsNull
); );
} if ($d->allowed !== null) {
foreach ($d->aliases as $alias) { $schema->addAllowedValues(
$schema->addAlias( $d->id->key,
$alias->key, $d->allowed
$d->id->key );
); }
} foreach ($d->aliases as $alias) {
if ($d->valueAliases !== null) { $schema->addAlias(
$schema->addValueAliases( $alias->key,
$d->id->key, $d->id->key
$d->valueAliases );
); }
} if ($d->valueAliases !== null) {
} $schema->addValueAliases(
$schema->postProcess(); $d->id->key,
return $schema; $d->valueAliases
} );
}
} }
$schema->postProcess();
// vim: et sw=4 sts=4 return $schema;
}
}
// vim: et sw=4 sts=4
@@ -1,106 +1,144 @@
<?php <?php
/** /**
* Converts HTMLPurifier_ConfigSchema_Interchange to an XML format, * Converts HTMLPurifier_ConfigSchema_Interchange to an XML format,
* which can be further processed to generate documentation. * which can be further processed to generate documentation.
*/ */
class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
{ {
protected $interchange; /**
private $namespace; * @type HTMLPurifier_ConfigSchema_Interchange
*/
protected function writeHTMLDiv($html) { protected $interchange;
$this->startElement('div');
/**
$purifier = HTMLPurifier::getInstance(); * @type string
$html = $purifier->purify($html); */
$this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); private $namespace;
$this->writeRaw($html);
/**
$this->endElement(); // div * @param string $html
} */
protected function writeHTMLDiv($html)
protected function export($var) { {
if ($var === array()) return 'array()'; $this->startElement('div');
return var_export($var, true);
} $purifier = HTMLPurifier::getInstance();
$html = $purifier->purify($html);
public function build($interchange) { $this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
// global access, only use as last resort $this->writeRaw($html);
$this->interchange = $interchange;
$this->endElement(); // div
$this->setIndent(true); }
$this->startDocument('1.0', 'UTF-8');
$this->startElement('configdoc'); /**
$this->writeElement('title', $interchange->name); * @param mixed $var
* @return string
foreach ($interchange->directives as $directive) { */
$this->buildDirective($directive); protected function export($var)
} {
if ($var === array()) {
if ($this->namespace) $this->endElement(); // namespace return 'array()';
}
$this->endElement(); // configdoc return var_export($var, true);
$this->flush(); }
}
/**
public function buildDirective($directive) { * @param HTMLPurifier_ConfigSchema_Interchange $interchange
*/
// Kludge, although I suppose having a notion of a "root namespace" public function build($interchange)
// certainly makes things look nicer when documentation is built. {
// Depends on things being sorted. // global access, only use as last resort
if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) { $this->interchange = $interchange;
if ($this->namespace) $this->endElement(); // namespace
$this->namespace = $directive->id->getRootNamespace(); $this->setIndent(true);
$this->startElement('namespace'); $this->startDocument('1.0', 'UTF-8');
$this->writeAttribute('id', $this->namespace); $this->startElement('configdoc');
$this->writeElement('name', $this->namespace); $this->writeElement('title', $interchange->name);
}
foreach ($interchange->directives as $directive) {
$this->startElement('directive'); $this->buildDirective($directive);
$this->writeAttribute('id', $directive->id->toString()); }
$this->writeElement('name', $directive->id->getDirective()); if ($this->namespace) {
$this->endElement();
$this->startElement('aliases'); } // namespace
foreach ($directive->aliases as $alias) $this->writeElement('alias', $alias->toString());
$this->endElement(); // aliases $this->endElement(); // configdoc
$this->flush();
$this->startElement('constraints'); }
if ($directive->version) $this->writeElement('version', $directive->version);
$this->startElement('type'); /**
if ($directive->typeAllowsNull) $this->writeAttribute('allow-null', 'yes'); * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
$this->text($directive->type); */
$this->endElement(); // type public function buildDirective($directive)
if ($directive->allowed) { {
$this->startElement('allowed'); // Kludge, although I suppose having a notion of a "root namespace"
foreach ($directive->allowed as $value => $x) $this->writeElement('value', $value); // certainly makes things look nicer when documentation is built.
$this->endElement(); // allowed // Depends on things being sorted.
} if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) {
$this->writeElement('default', $this->export($directive->default)); if ($this->namespace) {
$this->writeAttribute('xml:space', 'preserve'); $this->endElement();
if ($directive->external) { } // namespace
$this->startElement('external'); $this->namespace = $directive->id->getRootNamespace();
foreach ($directive->external as $project) $this->writeElement('project', $project); $this->startElement('namespace');
$this->endElement(); $this->writeAttribute('id', $this->namespace);
} $this->writeElement('name', $this->namespace);
$this->endElement(); // constraints }
if ($directive->deprecatedVersion) { $this->startElement('directive');
$this->startElement('deprecated'); $this->writeAttribute('id', $directive->id->toString());
$this->writeElement('version', $directive->deprecatedVersion);
$this->writeElement('use', $directive->deprecatedUse->toString()); $this->writeElement('name', $directive->id->getDirective());
$this->endElement(); // deprecated
} $this->startElement('aliases');
foreach ($directive->aliases as $alias) {
$this->startElement('description'); $this->writeElement('alias', $alias->toString());
$this->writeHTMLDiv($directive->description); }
$this->endElement(); // description $this->endElement(); // aliases
$this->endElement(); // directive $this->startElement('constraints');
} if ($directive->version) {
$this->writeElement('version', $directive->version);
} }
$this->startElement('type');
// vim: et sw=4 sts=4 if ($directive->typeAllowsNull) {
$this->writeAttribute('allow-null', 'yes');
}
$this->text($directive->type);
$this->endElement(); // type
if ($directive->allowed) {
$this->startElement('allowed');
foreach ($directive->allowed as $value => $x) {
$this->writeElement('value', $value);
}
$this->endElement(); // allowed
}
$this->writeElement('default', $this->export($directive->default));
$this->writeAttribute('xml:space', 'preserve');
if ($directive->external) {
$this->startElement('external');
foreach ($directive->external as $project) {
$this->writeElement('project', $project);
}
$this->endElement();
}
$this->endElement(); // constraints
if ($directive->deprecatedVersion) {
$this->startElement('deprecated');
$this->writeElement('version', $directive->deprecatedVersion);
$this->writeElement('use', $directive->deprecatedUse->toString());
$this->endElement(); // deprecated
}
$this->startElement('description');
$this->writeHTMLDiv($directive->description);
$this->endElement(); // description
$this->endElement(); // directive
}
}
// vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
<?php <?php
/** /**
* Exceptions related to configuration schema * Exceptions related to configuration schema
*/ */
class HTMLPurifier_ConfigSchema_Exception extends HTMLPurifier_Exception class HTMLPurifier_ConfigSchema_Exception extends HTMLPurifier_Exception
{ {
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -1,42 +1,47 @@
<?php <?php
/** /**
* Generic schema interchange format that can be converted to a runtime * Generic schema interchange format that can be converted to a runtime
* representation (HTMLPurifier_ConfigSchema) or HTML documentation. Members * representation (HTMLPurifier_ConfigSchema) or HTML documentation. Members
* are completely validated. * are completely validated.
*/ */
class HTMLPurifier_ConfigSchema_Interchange class HTMLPurifier_ConfigSchema_Interchange
{ {
/** /**
* Name of the application this schema is describing. * Name of the application this schema is describing.
*/ * @type string
public $name; */
public $name;
/**
* Array of Directive ID => array(directive info) /**
*/ * Array of Directive ID => array(directive info)
public $directives = array(); * @type HTMLPurifier_ConfigSchema_Interchange_Directive[]
*/
/** public $directives = array();
* Adds a directive array to $directives
*/ /**
public function addDirective($directive) { * Adds a directive array to $directives
if (isset($this->directives[$i = $directive->id->toString()])) { * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'"); * @throws HTMLPurifier_ConfigSchema_Exception
} */
$this->directives[$i] = $directive; public function addDirective($directive)
} {
if (isset($this->directives[$i = $directive->id->toString()])) {
/** throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
* Convenience function to perform standard validation. Throws exception }
* on failed validation. $this->directives[$i] = $directive;
*/ }
public function validate() {
$validator = new HTMLPurifier_ConfigSchema_Validator(); /**
return $validator->validate($this); * Convenience function to perform standard validation. Throws exception
} * on failed validation.
*/
} public function validate()
{
// vim: et sw=4 sts=4 $validator = new HTMLPurifier_ConfigSchema_Validator();
return $validator->validate($this);
}
}
// vim: et sw=4 sts=4
@@ -1,77 +1,89 @@
<?php <?php
/** /**
* Interchange component class describing configuration directives. * Interchange component class describing configuration directives.
*/ */
class HTMLPurifier_ConfigSchema_Interchange_Directive class HTMLPurifier_ConfigSchema_Interchange_Directive
{ {
/** /**
* ID of directive, instance of HTMLPurifier_ConfigSchema_Interchange_Id. * ID of directive.
*/ * @type HTMLPurifier_ConfigSchema_Interchange_Id
public $id; */
public $id;
/**
* String type, e.g. 'integer' or 'istring'. /**
*/ * Type, e.g. 'integer' or 'istring'.
public $type; * @type string
*/
/** public $type;
* Default value, e.g. 3 or 'DefaultVal'.
*/ /**
public $default; * Default value, e.g. 3 or 'DefaultVal'.
* @type mixed
/** */
* HTML description. public $default;
*/
public $description; /**
* HTML description.
/** * @type string
* Boolean whether or not null is allowed as a value. */
*/ public $description;
public $typeAllowsNull = false;
/**
/** * Whether or not null is allowed as a value.
* Lookup table of allowed scalar values, e.g. array('allowed' => true). * @type bool
* Null if all values are allowed. */
*/ public $typeAllowsNull = false;
public $allowed;
/**
/** * Lookup table of allowed scalar values.
* List of aliases for the directive, * e.g. array('allowed' => true).
* e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))). * Null if all values are allowed.
*/ * @type array
public $aliases = array(); */
public $allowed;
/**
* Hash of value aliases, e.g. array('alt' => 'real'). Null if value /**
* aliasing is disabled (necessary for non-scalar types). * List of aliases for the directive.
*/ * e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))).
public $valueAliases; * @type HTMLPurifier_ConfigSchema_Interchange_Id[]
*/
/** public $aliases = array();
* Version of HTML Purifier the directive was introduced, e.g. '1.3.1'.
* Null if the directive has always existed. /**
*/ * Hash of value aliases, e.g. array('alt' => 'real'). Null if value
public $version; * aliasing is disabled (necessary for non-scalar types).
* @type array
/** */
* ID of directive that supercedes this old directive, is an instance public $valueAliases;
* of HTMLPurifier_ConfigSchema_Interchange_Id. Null if not deprecated.
*/ /**
public $deprecatedUse; * Version of HTML Purifier the directive was introduced, e.g. '1.3.1'.
* Null if the directive has always existed.
/** * @type string
* Version of HTML Purifier this directive was deprecated. Null if not */
* deprecated. public $version;
*/
public $deprecatedVersion; /**
* ID of directive that supercedes this old directive.
/** * Null if not deprecated.
* List of external projects this directive depends on, e.g. array('CSSTidy'). * @type HTMLPurifier_ConfigSchema_Interchange_Id
*/ */
public $external = array(); public $deprecatedUse;
} /**
* Version of HTML Purifier this directive was deprecated. Null if not
// vim: et sw=4 sts=4 * deprecated.
* @type string
*/
public $deprecatedVersion;
/**
* List of external projects this directive depends on, e.g. array('CSSTidy').
* @type array
*/
public $external = array();
}
// vim: et sw=4 sts=4
@@ -1,37 +1,58 @@
<?php <?php
/** /**
* Represents a directive ID in the interchange format. * Represents a directive ID in the interchange format.
*/ */
class HTMLPurifier_ConfigSchema_Interchange_Id class HTMLPurifier_ConfigSchema_Interchange_Id
{ {
public $key; /**
* @type string
public function __construct($key) { */
$this->key = $key; public $key;
}
/**
/** * @param string $key
* @warning This is NOT magic, to ensure that people don't abuse SPL and */
* cause problems for PHP 5.0 support. public function __construct($key)
*/ {
public function toString() { $this->key = $key;
return $this->key; }
}
/**
public function getRootNamespace() { * @return string
return substr($this->key, 0, strpos($this->key, ".")); * @warning This is NOT magic, to ensure that people don't abuse SPL and
} * cause problems for PHP 5.0 support.
*/
public function getDirective() { public function toString()
return substr($this->key, strpos($this->key, ".") + 1); {
} return $this->key;
}
public static function make($id) {
return new HTMLPurifier_ConfigSchema_Interchange_Id($id); /**
} * @return string
*/
} public function getRootNamespace()
{
// vim: et sw=4 sts=4 return substr($this->key, 0, strpos($this->key, "."));
}
/**
* @return string
*/
public function getDirective()
{
return substr($this->key, strpos($this->key, ".") + 1);
}
/**
* @param string $id
* @return HTMLPurifier_ConfigSchema_Interchange_Id
*/
public static function make($id)
{
return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
}
}
// vim: et sw=4 sts=4
@@ -1,180 +1,226 @@
<?php <?php
class HTMLPurifier_ConfigSchema_InterchangeBuilder class HTMLPurifier_ConfigSchema_InterchangeBuilder
{ {
/** /**
* Used for processing DEFAULT, nothing else. * Used for processing DEFAULT, nothing else.
*/ * @type HTMLPurifier_VarParser
protected $varParser; */
protected $varParser;
public function __construct($varParser = null) {
$this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native(); /**
} * @param HTMLPurifier_VarParser $varParser
*/
public static function buildFromDirectory($dir = null) { public function __construct($varParser = null)
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); {
$interchange = new HTMLPurifier_ConfigSchema_Interchange(); $this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native();
return $builder->buildDir($interchange, $dir); }
}
/**
public function buildDir($interchange, $dir = null) { * @param string $dir
if (!$dir) $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema'; * @return HTMLPurifier_ConfigSchema_Interchange
if (file_exists($dir . '/info.ini')) { */
$info = parse_ini_file($dir . '/info.ini'); public static function buildFromDirectory($dir = null)
$interchange->name = $info['name']; {
} $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
$interchange = new HTMLPurifier_ConfigSchema_Interchange();
$files = array(); return $builder->buildDir($interchange, $dir);
$dh = opendir($dir); }
while (false !== ($file = readdir($dh))) {
if (!$file || $file[0] == '.' || strrchr($file, '.') !== '.txt') { /**
continue; * @param HTMLPurifier_ConfigSchema_Interchange $interchange
} * @param string $dir
$files[] = $file; * @return HTMLPurifier_ConfigSchema_Interchange
} */
closedir($dh); public function buildDir($interchange, $dir = null)
{
sort($files); if (!$dir) {
foreach ($files as $file) { $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema';
$this->buildFile($interchange, $dir . '/' . $file); }
} if (file_exists($dir . '/info.ini')) {
$info = parse_ini_file($dir . '/info.ini');
return $interchange; $interchange->name = $info['name'];
} }
public function buildFile($interchange, $file) { $files = array();
$parser = new HTMLPurifier_StringHashParser(); $dh = opendir($dir);
$this->build( while (false !== ($file = readdir($dh))) {
$interchange, if (!$file || $file[0] == '.' || strrchr($file, '.') !== '.txt') {
new HTMLPurifier_StringHash( $parser->parseFile($file) ) continue;
); }
} $files[] = $file;
}
/** closedir($dh);
* Builds an interchange object based on a hash.
* @param $interchange HTMLPurifier_ConfigSchema_Interchange object to build sort($files);
* @param $hash HTMLPurifier_ConfigSchema_StringHash source data foreach ($files as $file) {
*/ $this->buildFile($interchange, $dir . '/' . $file);
public function build($interchange, $hash) { }
if (!$hash instanceof HTMLPurifier_StringHash) { return $interchange;
$hash = new HTMLPurifier_StringHash($hash); }
}
if (!isset($hash['ID'])) { /**
throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID'); * @param HTMLPurifier_ConfigSchema_Interchange $interchange
} * @param string $file
if (strpos($hash['ID'], '.') === false) { */
if (count($hash) == 2 && isset($hash['DESCRIPTION'])) { public function buildFile($interchange, $file)
$hash->offsetGet('DESCRIPTION'); // prevent complaining {
} else { $parser = new HTMLPurifier_StringHashParser();
throw new HTMLPurifier_ConfigSchema_Exception('All directives must have a namespace'); $this->build(
} $interchange,
} else { new HTMLPurifier_StringHash($parser->parseFile($file))
$this->buildDirective($interchange, $hash); );
} }
$this->_findUnused($hash);
} /**
* Builds an interchange object based on a hash.
public function buildDirective($interchange, $hash) { * @param HTMLPurifier_ConfigSchema_Interchange $interchange HTMLPurifier_ConfigSchema_Interchange object to build
$directive = new HTMLPurifier_ConfigSchema_Interchange_Directive(); * @param HTMLPurifier_StringHash $hash source data
* @throws HTMLPurifier_ConfigSchema_Exception
// These are required elements: */
$directive->id = $this->id($hash->offsetGet('ID')); public function build($interchange, $hash)
$id = $directive->id->toString(); // convenience {
if (!$hash instanceof HTMLPurifier_StringHash) {
if (isset($hash['TYPE'])) { $hash = new HTMLPurifier_StringHash($hash);
$type = explode('/', $hash->offsetGet('TYPE')); }
if (isset($type[1])) $directive->typeAllowsNull = true; if (!isset($hash['ID'])) {
$directive->type = $type[0]; throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID');
} else { }
throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined"); if (strpos($hash['ID'], '.') === false) {
} if (count($hash) == 2 && isset($hash['DESCRIPTION'])) {
$hash->offsetGet('DESCRIPTION'); // prevent complaining
if (isset($hash['DEFAULT'])) { } else {
try { throw new HTMLPurifier_ConfigSchema_Exception('All directives must have a namespace');
$directive->default = $this->varParser->parse($hash->offsetGet('DEFAULT'), $directive->type, $directive->typeAllowsNull); }
} catch (HTMLPurifier_VarParserException $e) { } else {
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'"); $this->buildDirective($interchange, $hash);
} }
} $this->_findUnused($hash);
}
if (isset($hash['DESCRIPTION'])) {
$directive->description = $hash->offsetGet('DESCRIPTION'); /**
} * @param HTMLPurifier_ConfigSchema_Interchange $interchange
* @param HTMLPurifier_StringHash $hash
if (isset($hash['ALLOWED'])) { * @throws HTMLPurifier_ConfigSchema_Exception
$directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED'))); */
} public function buildDirective($interchange, $hash)
{
if (isset($hash['VALUE-ALIASES'])) { $directive = new HTMLPurifier_ConfigSchema_Interchange_Directive();
$directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
} // These are required elements:
$directive->id = $this->id($hash->offsetGet('ID'));
if (isset($hash['ALIASES'])) { $id = $directive->id->toString(); // convenience
$raw_aliases = trim($hash->offsetGet('ALIASES'));
$aliases = preg_split('/\s*,\s*/', $raw_aliases); if (isset($hash['TYPE'])) {
foreach ($aliases as $alias) { $type = explode('/', $hash->offsetGet('TYPE'));
$directive->aliases[] = $this->id($alias); if (isset($type[1])) {
} $directive->typeAllowsNull = true;
} }
$directive->type = $type[0];
if (isset($hash['VERSION'])) { } else {
$directive->version = $hash->offsetGet('VERSION'); throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
} }
if (isset($hash['DEPRECATED-USE'])) { if (isset($hash['DEFAULT'])) {
$directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE')); try {
} $directive->default = $this->varParser->parse(
$hash->offsetGet('DEFAULT'),
if (isset($hash['DEPRECATED-VERSION'])) { $directive->type,
$directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION'); $directive->typeAllowsNull
} );
} catch (HTMLPurifier_VarParserException $e) {
if (isset($hash['EXTERNAL'])) { throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'");
$directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL'))); }
} }
$interchange->addDirective($directive); if (isset($hash['DESCRIPTION'])) {
} $directive->description = $hash->offsetGet('DESCRIPTION');
}
/**
* Evaluates an array PHP code string without array() wrapper if (isset($hash['ALLOWED'])) {
*/ $directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED')));
protected function evalArray($contents) { }
return eval('return array('. $contents .');');
} if (isset($hash['VALUE-ALIASES'])) {
$directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
/** }
* Converts an array list into a lookup array.
*/ if (isset($hash['ALIASES'])) {
protected function lookup($array) { $raw_aliases = trim($hash->offsetGet('ALIASES'));
$ret = array(); $aliases = preg_split('/\s*,\s*/', $raw_aliases);
foreach ($array as $val) $ret[$val] = true; foreach ($aliases as $alias) {
return $ret; $directive->aliases[] = $this->id($alias);
} }
}
/**
* Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id if (isset($hash['VERSION'])) {
* object based on a string Id. $directive->version = $hash->offsetGet('VERSION');
*/ }
protected function id($id) {
return HTMLPurifier_ConfigSchema_Interchange_Id::make($id); if (isset($hash['DEPRECATED-USE'])) {
} $directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE'));
}
/**
* Triggers errors for any unused keys passed in the hash; such keys if (isset($hash['DEPRECATED-VERSION'])) {
* may indicate typos, missing values, etc. $directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION');
* @param $hash Instance of ConfigSchema_StringHash to check. }
*/
protected function _findUnused($hash) { if (isset($hash['EXTERNAL'])) {
$accessed = $hash->getAccessed(); $directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL')));
foreach ($hash as $k => $v) { }
if (!isset($accessed[$k])) {
trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE); $interchange->addDirective($directive);
} }
}
} /**
* Evaluates an array PHP code string without array() wrapper
} * @param string $contents
*/
// vim: et sw=4 sts=4 protected function evalArray($contents)
{
return eval('return array(' . $contents . ');');
}
/**
* Converts an array list into a lookup array.
* @param array $array
* @return array
*/
protected function lookup($array)
{
$ret = array();
foreach ($array as $val) {
$ret[$val] = true;
}
return $ret;
}
/**
* Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id
* object based on a string Id.
* @param string $id
* @return HTMLPurifier_ConfigSchema_Interchange_Id
*/
protected function id($id)
{
return HTMLPurifier_ConfigSchema_Interchange_Id::make($id);
}
/**
* Triggers errors for any unused keys passed in the hash; such keys
* may indicate typos, missing values, etc.
* @param HTMLPurifier_StringHash $hash Hash to check.
*/
protected function _findUnused($hash)
{
$accessed = $hash->getAccessed();
foreach ($hash as $k => $v) {
if (!isset($accessed[$k])) {
trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE);
}
}
}
}
// vim: et sw=4 sts=4
@@ -1,206 +1,248 @@
<?php <?php
/** /**
* Performs validations on HTMLPurifier_ConfigSchema_Interchange * Performs validations on HTMLPurifier_ConfigSchema_Interchange
* *
* @note If you see '// handled by InterchangeBuilder', that means a * @note If you see '// handled by InterchangeBuilder', that means a
* design decision in that class would prevent this validation from * design decision in that class would prevent this validation from
* ever being necessary. We have them anyway, however, for * ever being necessary. We have them anyway, however, for
* redundancy. * redundancy.
*/ */
class HTMLPurifier_ConfigSchema_Validator class HTMLPurifier_ConfigSchema_Validator
{ {
/** /**
* Easy to access global objects. * @type HTMLPurifier_ConfigSchema_Interchange
*/ */
protected $interchange, $aliases; protected $interchange;
/** /**
* Context-stack to provide easy to read error messages. * @type array
*/ */
protected $context = array(); protected $aliases;
/** /**
* HTMLPurifier_VarParser to test default's type. * Context-stack to provide easy to read error messages.
*/ * @type array
protected $parser; */
protected $context = array();
public function __construct() {
$this->parser = new HTMLPurifier_VarParser(); /**
} * to test default's type.
* @type HTMLPurifier_VarParser
/** */
* Validates a fully-formed interchange object. Throws an protected $parser;
* HTMLPurifier_ConfigSchema_Exception if there's a problem.
*/ public function __construct()
public function validate($interchange) { {
$this->interchange = $interchange; $this->parser = new HTMLPurifier_VarParser();
$this->aliases = array(); }
// PHP is a bit lax with integer <=> string conversions in
// arrays, so we don't use the identical !== comparison /**
foreach ($interchange->directives as $i => $directive) { * Validates a fully-formed interchange object.
$id = $directive->id->toString(); * @param HTMLPurifier_ConfigSchema_Interchange $interchange
if ($i != $id) $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'"); * @return bool
$this->validateDirective($directive); */
} public function validate($interchange)
return true; {
} $this->interchange = $interchange;
$this->aliases = array();
/** // PHP is a bit lax with integer <=> string conversions in
* Validates a HTMLPurifier_ConfigSchema_Interchange_Id object. // arrays, so we don't use the identical !== comparison
*/ foreach ($interchange->directives as $i => $directive) {
public function validateId($id) { $id = $directive->id->toString();
$id_string = $id->toString(); if ($i != $id) {
$this->context[] = "id '$id_string'"; $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) { }
// handled by InterchangeBuilder $this->validateDirective($directive);
$this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id'); }
} return true;
// keys are now unconstrained (we might want to narrow down to A-Za-z0-9.) }
// we probably should check that it has at least one namespace
$this->with($id, 'key') /**
->assertNotEmpty() * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
->assertIsString(); // implicit assertIsString handled by InterchangeBuilder * @param HTMLPurifier_ConfigSchema_Interchange_Id $id
array_pop($this->context); */
} public function validateId($id)
{
/** $id_string = $id->toString();
* Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object. $this->context[] = "id '$id_string'";
*/ if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
public function validateDirective($d) { // handled by InterchangeBuilder
$id = $d->id->toString(); $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
$this->context[] = "directive '$id'"; }
$this->validateId($d->id); // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
// we probably should check that it has at least one namespace
$this->with($d, 'description') $this->with($id, 'key')
->assertNotEmpty(); ->assertNotEmpty()
->assertIsString(); // implicit assertIsString handled by InterchangeBuilder
// BEGIN - handled by InterchangeBuilder array_pop($this->context);
$this->with($d, 'type') }
->assertNotEmpty();
$this->with($d, 'typeAllowsNull') /**
->assertIsBool(); * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
try { * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
// This also tests validity of $d->type */
$this->parser->parse($d->default, $d->type, $d->typeAllowsNull); public function validateDirective($d)
} catch (HTMLPurifier_VarParserException $e) { {
$this->error('default', 'had error: ' . $e->getMessage()); $id = $d->id->toString();
} $this->context[] = "directive '$id'";
// END - handled by InterchangeBuilder $this->validateId($d->id);
if (!is_null($d->allowed) || !empty($d->valueAliases)) { $this->with($d, 'description')
// allowed and valueAliases require that we be dealing with ->assertNotEmpty();
// strings, so check for that early.
$d_int = HTMLPurifier_VarParser::$types[$d->type]; // BEGIN - handled by InterchangeBuilder
if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) { $this->with($d, 'type')
$this->error('type', 'must be a string type when used with allowed or value aliases'); ->assertNotEmpty();
} $this->with($d, 'typeAllowsNull')
} ->assertIsBool();
try {
$this->validateDirectiveAllowed($d); // This also tests validity of $d->type
$this->validateDirectiveValueAliases($d); $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
$this->validateDirectiveAliases($d); } catch (HTMLPurifier_VarParserException $e) {
$this->error('default', 'had error: ' . $e->getMessage());
array_pop($this->context); }
} // END - handled by InterchangeBuilder
/** if (!is_null($d->allowed) || !empty($d->valueAliases)) {
* Extra validation if $allowed member variable of // allowed and valueAliases require that we be dealing with
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined. // strings, so check for that early.
*/ $d_int = HTMLPurifier_VarParser::$types[$d->type];
public function validateDirectiveAllowed($d) { if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {
if (is_null($d->allowed)) return; $this->error('type', 'must be a string type when used with allowed or value aliases');
$this->with($d, 'allowed') }
->assertNotEmpty() }
->assertIsLookup(); // handled by InterchangeBuilder
if (is_string($d->default) && !isset($d->allowed[$d->default])) { $this->validateDirectiveAllowed($d);
$this->error('default', 'must be an allowed value'); $this->validateDirectiveValueAliases($d);
} $this->validateDirectiveAliases($d);
$this->context[] = 'allowed';
foreach ($d->allowed as $val => $x) { array_pop($this->context);
if (!is_string($val)) $this->error("value $val", 'must be a string'); }
}
array_pop($this->context); /**
} * Extra validation if $allowed member variable of
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
/** * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
* Extra validation if $valueAliases member variable of */
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined. public function validateDirectiveAllowed($d)
*/ {
public function validateDirectiveValueAliases($d) { if (is_null($d->allowed)) {
if (is_null($d->valueAliases)) return; return;
$this->with($d, 'valueAliases') }
->assertIsArray(); // handled by InterchangeBuilder $this->with($d, 'allowed')
$this->context[] = 'valueAliases'; ->assertNotEmpty()
foreach ($d->valueAliases as $alias => $real) { ->assertIsLookup(); // handled by InterchangeBuilder
if (!is_string($alias)) $this->error("alias $alias", 'must be a string'); if (is_string($d->default) && !isset($d->allowed[$d->default])) {
if (!is_string($real)) $this->error("alias target $real from alias '$alias'", 'must be a string'); $this->error('default', 'must be an allowed value');
if ($alias === $real) { }
$this->error("alias '$alias'", "must not be an alias to itself"); $this->context[] = 'allowed';
} foreach ($d->allowed as $val => $x) {
} if (!is_string($val)) {
if (!is_null($d->allowed)) { $this->error("value $val", 'must be a string');
foreach ($d->valueAliases as $alias => $real) { }
if (isset($d->allowed[$alias])) { }
$this->error("alias '$alias'", 'must not be an allowed value'); array_pop($this->context);
} elseif (!isset($d->allowed[$real])) { }
$this->error("alias '$alias'", 'must be an alias to an allowed value');
} /**
} * Extra validation if $valueAliases member variable of
} * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
array_pop($this->context); * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
} */
public function validateDirectiveValueAliases($d)
/** {
* Extra validation if $aliases member variable of if (is_null($d->valueAliases)) {
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined. return;
*/ }
public function validateDirectiveAliases($d) { $this->with($d, 'valueAliases')
$this->with($d, 'aliases') ->assertIsArray(); // handled by InterchangeBuilder
->assertIsArray(); // handled by InterchangeBuilder $this->context[] = 'valueAliases';
$this->context[] = 'aliases'; foreach ($d->valueAliases as $alias => $real) {
foreach ($d->aliases as $alias) { if (!is_string($alias)) {
$this->validateId($alias); $this->error("alias $alias", 'must be a string');
$s = $alias->toString(); }
if (isset($this->interchange->directives[$s])) { if (!is_string($real)) {
$this->error("alias '$s'", 'collides with another directive'); $this->error("alias target $real from alias '$alias'", 'must be a string');
} }
if (isset($this->aliases[$s])) { if ($alias === $real) {
$other_directive = $this->aliases[$s]; $this->error("alias '$alias'", "must not be an alias to itself");
$this->error("alias '$s'", "collides with alias for directive '$other_directive'"); }
} }
$this->aliases[$s] = $d->id->toString(); if (!is_null($d->allowed)) {
} foreach ($d->valueAliases as $alias => $real) {
array_pop($this->context); if (isset($d->allowed[$alias])) {
} $this->error("alias '$alias'", 'must not be an allowed value');
} elseif (!isset($d->allowed[$real])) {
// protected helper functions $this->error("alias '$alias'", 'must be an alias to an allowed value');
}
/** }
* Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom }
* for validating simple member variables of objects. array_pop($this->context);
*/ }
protected function with($obj, $member) {
return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member); /**
} * Extra validation if $aliases member variable of
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
/** * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
* Emits an error, providing helpful context. */
*/ public function validateDirectiveAliases($d)
protected function error($target, $msg) { {
if ($target !== false) $prefix = ucfirst($target) . ' in ' . $this->getFormattedContext(); $this->with($d, 'aliases')
else $prefix = ucfirst($this->getFormattedContext()); ->assertIsArray(); // handled by InterchangeBuilder
throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg)); $this->context[] = 'aliases';
} foreach ($d->aliases as $alias) {
$this->validateId($alias);
/** $s = $alias->toString();
* Returns a formatted context string. if (isset($this->interchange->directives[$s])) {
*/ $this->error("alias '$s'", 'collides with another directive');
protected function getFormattedContext() { }
return implode(' in ', array_reverse($this->context)); if (isset($this->aliases[$s])) {
} $other_directive = $this->aliases[$s];
$this->error("alias '$s'", "collides with alias for directive '$other_directive'");
} }
$this->aliases[$s] = $d->id->toString();
// vim: et sw=4 sts=4 }
array_pop($this->context);
}
// protected helper functions
/**
* Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
* for validating simple member variables of objects.
* @param $obj
* @param $member
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
protected function with($obj, $member)
{
return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
}
/**
* Emits an error, providing helpful context.
* @throws HTMLPurifier_ConfigSchema_Exception
*/
protected function error($target, $msg)
{
if ($target !== false) {
$prefix = ucfirst($target) . ' in ' . $this->getFormattedContext();
} else {
$prefix = ucfirst($this->getFormattedContext());
}
throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
}
/**
* Returns a formatted context string.
* @return string
*/
protected function getFormattedContext()
{
return implode(' in ', array_reverse($this->context));
}
}
// vim: et sw=4 sts=4
@@ -1,66 +1,130 @@
<?php <?php
/** /**
* Fluent interface for validating the contents of member variables. * Fluent interface for validating the contents of member variables.
* This should be immutable. See HTMLPurifier_ConfigSchema_Validator for * This should be immutable. See HTMLPurifier_ConfigSchema_Validator for
* use-cases. We name this an 'atom' because it's ONLY for validations that * use-cases. We name this an 'atom' because it's ONLY for validations that
* are independent and usually scalar. * are independent and usually scalar.
*/ */
class HTMLPurifier_ConfigSchema_ValidatorAtom class HTMLPurifier_ConfigSchema_ValidatorAtom
{ {
/**
protected $context, $obj, $member, $contents; * @type string
*/
public function __construct($context, $obj, $member) { protected $context;
$this->context = $context;
$this->obj = $obj; /**
$this->member = $member; * @type object
$this->contents =& $obj->$member; */
} protected $obj;
public function assertIsString() { /**
if (!is_string($this->contents)) $this->error('must be a string'); * @type string
return $this; */
} protected $member;
public function assertIsBool() { /**
if (!is_bool($this->contents)) $this->error('must be a boolean'); * @type mixed
return $this; */
} protected $contents;
public function assertIsArray() { public function __construct($context, $obj, $member)
if (!is_array($this->contents)) $this->error('must be an array'); {
return $this; $this->context = $context;
} $this->obj = $obj;
$this->member = $member;
public function assertNotNull() { $this->contents =& $obj->$member;
if ($this->contents === null) $this->error('must not be null'); }
return $this;
} /**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
public function assertAlnum() { */
$this->assertIsString(); public function assertIsString()
if (!ctype_alnum($this->contents)) $this->error('must be alphanumeric'); {
return $this; if (!is_string($this->contents)) {
} $this->error('must be a string');
}
public function assertNotEmpty() { return $this;
if (empty($this->contents)) $this->error('must not be empty'); }
return $this;
} /**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
public function assertIsLookup() { */
$this->assertIsArray(); public function assertIsBool()
foreach ($this->contents as $v) { {
if ($v !== true) $this->error('must be a lookup array'); if (!is_bool($this->contents)) {
} $this->error('must be a boolean');
return $this; }
} return $this;
}
protected function error($msg) {
throw new HTMLPurifier_ConfigSchema_Exception(ucfirst($this->member) . ' in ' . $this->context . ' ' . $msg); /**
} * @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
} public function assertIsArray()
{
// vim: et sw=4 sts=4 if (!is_array($this->contents)) {
$this->error('must be an array');
}
return $this;
}
/**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
public function assertNotNull()
{
if ($this->contents === null) {
$this->error('must not be null');
}
return $this;
}
/**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
public function assertAlnum()
{
$this->assertIsString();
if (!ctype_alnum($this->contents)) {
$this->error('must be alphanumeric');
}
return $this;
}
/**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
public function assertNotEmpty()
{
if (empty($this->contents)) {
$this->error('must not be empty');
}
return $this;
}
/**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
public function assertIsLookup()
{
$this->assertIsArray();
foreach ($this->contents as $v) {
if ($v !== true) {
$this->error('must be a lookup array');
}
}
return $this;
}
/**
* @param string $msg
* @throws HTMLPurifier_ConfigSchema_Exception
*/
protected function error($msg)
{
throw new HTMLPurifier_ConfigSchema_Exception(ucfirst($this->member) . ' in ' . $this->context . ' ' . $msg);
}
}
// vim: et sw=4 sts=4
@@ -1,8 +1,8 @@
Attr.AllowedClasses Attr.AllowedClasses
TYPE: lookup/null TYPE: lookup/null
VERSION: 4.0.0 VERSION: 4.0.0
DEFAULT: null DEFAULT: null
--DESCRIPTION-- --DESCRIPTION--
List of allowed class values in the class attribute. By default, this is null, List of allowed class values in the class attribute. By default, this is null,
which means all classes are allowed. which means all classes are allowed.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
Attr.AllowedFrameTargets Attr.AllowedFrameTargets
TYPE: lookup TYPE: lookup
DEFAULT: array() DEFAULT: array()
--DESCRIPTION-- --DESCRIPTION--
Lookup table of all allowed link frame targets. Some commonly used link Lookup table of all allowed link frame targets. Some commonly used link
targets include _blank, _self, _parent and _top. Values should be targets include _blank, _self, _parent and _top. Values should be
lowercase, as validation will be done in a case-sensitive manner despite lowercase, as validation will be done in a case-sensitive manner despite
W3C's recommendation. XHTML 1.0 Strict does not permit the target attribute W3C's recommendation. XHTML 1.0 Strict does not permit the target attribute
so this directive will have no effect in that doctype. XHTML 1.1 does not so this directive will have no effect in that doctype. XHTML 1.1 does not
enable the Target module by default, you will have to manually enable it enable the Target module by default, you will have to manually enable it
(see the module documentation for more details.) (see the module documentation for more details.)
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,9 +1,9 @@
Attr.AllowedRel Attr.AllowedRel
TYPE: lookup TYPE: lookup
VERSION: 1.6.0 VERSION: 1.6.0
DEFAULT: array() DEFAULT: array()
--DESCRIPTION-- --DESCRIPTION--
List of allowed forward document relationships in the rel attribute. Common List of allowed forward document relationships in the rel attribute. Common
values may be nofollow or print. By default, this is empty, meaning that no values may be nofollow or print. By default, this is empty, meaning that no
document relationships are allowed. document relationships are allowed.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,9 +1,9 @@
Attr.AllowedRev Attr.AllowedRev
TYPE: lookup TYPE: lookup
VERSION: 1.6.0 VERSION: 1.6.0
DEFAULT: array() DEFAULT: array()
--DESCRIPTION-- --DESCRIPTION--
List of allowed reverse document relationships in the rev attribute. This List of allowed reverse document relationships in the rev attribute. This
attribute is a bit of an edge-case; if you don't know what it is for, stay attribute is a bit of an edge-case; if you don't know what it is for, stay
away. away.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,19 +1,19 @@
Attr.ClassUseCDATA Attr.ClassUseCDATA
TYPE: bool/null TYPE: bool/null
DEFAULT: null DEFAULT: null
VERSION: 4.0.0 VERSION: 4.0.0
--DESCRIPTION-- --DESCRIPTION--
If null, class will auto-detect the doctype and, if matching XHTML 1.1 or If null, class will auto-detect the doctype and, if matching XHTML 1.1 or
XHTML 2.0, will use the restrictive NMTOKENS specification of class. Otherwise, XHTML 2.0, will use the restrictive NMTOKENS specification of class. Otherwise,
it will use a relaxed CDATA definition. If true, the relaxed CDATA definition it will use a relaxed CDATA definition. If true, the relaxed CDATA definition
is forced; if false, the NMTOKENS definition is forced. To get behavior is forced; if false, the NMTOKENS definition is forced. To get behavior
of HTML Purifier prior to 4.0.0, set this directive to false. of HTML Purifier prior to 4.0.0, set this directive to false.
Some rational behind the auto-detection: Some rational behind the auto-detection:
in previous versions of HTML Purifier, it was assumed that the form of in previous versions of HTML Purifier, it was assumed that the form of
class was NMTOKENS, as specified by the XHTML Modularization (representing class was NMTOKENS, as specified by the XHTML Modularization (representing
XHTML 1.1 and XHTML 2.0). The DTDs for HTML 4.01 and XHTML 1.0, however XHTML 1.1 and XHTML 2.0). The DTDs for HTML 4.01 and XHTML 1.0, however
specify class as CDATA. HTML 5 effectively defines it as CDATA, but specify class as CDATA. HTML 5 effectively defines it as CDATA, but
with the additional constraint that each name should be unique (this is not with the additional constraint that each name should be unique (this is not
explicitly outlined in previous specifications). explicitly outlined in previous specifications).
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
Attr.DefaultImageAlt Attr.DefaultImageAlt
TYPE: string/null TYPE: string/null
DEFAULT: null DEFAULT: null
VERSION: 3.2.0 VERSION: 3.2.0
--DESCRIPTION-- --DESCRIPTION--
This is the content of the alt tag of an image if the user had not This is the content of the alt tag of an image if the user had not
previously specified an alt attribute. This applies to all images without previously specified an alt attribute. This applies to all images without
a valid alt attribute, as opposed to %Attr.DefaultInvalidImageAlt, which a valid alt attribute, as opposed to %Attr.DefaultInvalidImageAlt, which
only applies to invalid images, and overrides in the case of an invalid image. only applies to invalid images, and overrides in the case of an invalid image.
Default behavior with null is to use the basename of the src tag for the alt. Default behavior with null is to use the basename of the src tag for the alt.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,9 +1,9 @@
Attr.DefaultInvalidImage Attr.DefaultInvalidImage
TYPE: string TYPE: string
DEFAULT: '' DEFAULT: ''
--DESCRIPTION-- --DESCRIPTION--
This is the default image an img tag will be pointed to if it does not have This is the default image an img tag will be pointed to if it does not have
a valid src attribute. In future versions, we may allow the image tag to a valid src attribute. In future versions, we may allow the image tag to
be removed completely, but due to design issues, this is not possible right be removed completely, but due to design issues, this is not possible right
now. now.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,8 +1,8 @@
Attr.DefaultInvalidImageAlt Attr.DefaultInvalidImageAlt
TYPE: string TYPE: string
DEFAULT: 'Invalid image' DEFAULT: 'Invalid image'
--DESCRIPTION-- --DESCRIPTION--
This is the content of the alt tag of an invalid image if the user had not This is the content of the alt tag of an invalid image if the user had not
previously specified an alt attribute. It has no effect when the image is previously specified an alt attribute. It has no effect when the image is
valid but there was no alt attribute present. valid but there was no alt attribute present.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,10 +1,10 @@
Attr.DefaultTextDir Attr.DefaultTextDir
TYPE: string TYPE: string
DEFAULT: 'ltr' DEFAULT: 'ltr'
--DESCRIPTION-- --DESCRIPTION--
Defines the default text direction (ltr or rtl) of the document being Defines the default text direction (ltr or rtl) of the document being
parsed. This generally is the same as the value of the dir attribute in parsed. This generally is the same as the value of the dir attribute in
HTML, or ltr if that is not specified. HTML, or ltr if that is not specified.
--ALLOWED-- --ALLOWED--
'ltr', 'rtl' 'ltr', 'rtl'
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,16 +1,16 @@
Attr.EnableID Attr.EnableID
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
VERSION: 1.2.0 VERSION: 1.2.0
--DESCRIPTION-- --DESCRIPTION--
Allows the ID attribute in HTML. This is disabled by default due to the Allows the ID attribute in HTML. This is disabled by default due to the
fact that without proper configuration user input can easily break the fact that without proper configuration user input can easily break the
validation of a webpage by specifying an ID that is already on the validation of a webpage by specifying an ID that is already on the
surrounding HTML. If you don't mind throwing caution to the wind, enable surrounding HTML. If you don't mind throwing caution to the wind, enable
this directive, but I strongly recommend you also consider blacklisting IDs this directive, but I strongly recommend you also consider blacklisting IDs
you use (%Attr.IDBlacklist) or prefixing all user supplied IDs you use (%Attr.IDBlacklist) or prefixing all user supplied IDs
(%Attr.IDPrefix). When set to true HTML Purifier reverts to the behavior of (%Attr.IDPrefix). When set to true HTML Purifier reverts to the behavior of
pre-1.2.0 versions. pre-1.2.0 versions.
--ALIASES-- --ALIASES--
HTML.EnableAttrID HTML.EnableAttrID
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,8 +1,8 @@
Attr.ForbiddenClasses Attr.ForbiddenClasses
TYPE: lookup TYPE: lookup
VERSION: 4.0.0 VERSION: 4.0.0
DEFAULT: array() DEFAULT: array()
--DESCRIPTION-- --DESCRIPTION--
List of forbidden class values in the class attribute. By default, this is List of forbidden class values in the class attribute. By default, this is
empty, which means that no classes are forbidden. See also %Attr.AllowedClasses. empty, which means that no classes are forbidden. See also %Attr.AllowedClasses.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,5 +1,5 @@
Attr.IDBlacklist Attr.IDBlacklist
TYPE: list TYPE: list
DEFAULT: array() DEFAULT: array()
DESCRIPTION: Array of IDs not allowed in the document. DESCRIPTION: Array of IDs not allowed in the document.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,9 +1,9 @@
Attr.IDBlacklistRegexp Attr.IDBlacklistRegexp
TYPE: string/null TYPE: string/null
VERSION: 1.6.0 VERSION: 1.6.0
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
PCRE regular expression to be matched against all IDs. If the expression is PCRE regular expression to be matched against all IDs. If the expression is
matches, the ID is rejected. Use this with care: may cause significant matches, the ID is rejected. Use this with care: may cause significant
degradation. ID matching is done after all other validation. degradation. ID matching is done after all other validation.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
Attr.IDPrefix Attr.IDPrefix
TYPE: string TYPE: string
VERSION: 1.2.0 VERSION: 1.2.0
DEFAULT: '' DEFAULT: ''
--DESCRIPTION-- --DESCRIPTION--
String to prefix to IDs. If you have no idea what IDs your pages may use, String to prefix to IDs. If you have no idea what IDs your pages may use,
you may opt to simply add a prefix to all user-submitted ID attributes so you may opt to simply add a prefix to all user-submitted ID attributes so
that they are still usable, but will not conflict with core page IDs. that they are still usable, but will not conflict with core page IDs.
Example: setting the directive to 'user_' will result in a user submitted Example: setting the directive to 'user_' will result in a user submitted
'foo' to become 'user_foo' Be sure to set %HTML.EnableAttrID to true 'foo' to become 'user_foo' Be sure to set %HTML.EnableAttrID to true
before using this. before using this.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,14 +1,14 @@
Attr.IDPrefixLocal Attr.IDPrefixLocal
TYPE: string TYPE: string
VERSION: 1.2.0 VERSION: 1.2.0
DEFAULT: '' DEFAULT: ''
--DESCRIPTION-- --DESCRIPTION--
Temporary prefix for IDs used in conjunction with %Attr.IDPrefix. If you Temporary prefix for IDs used in conjunction with %Attr.IDPrefix. If you
need to allow multiple sets of user content on web page, you may need to need to allow multiple sets of user content on web page, you may need to
have a seperate prefix that changes with each iteration. This way, have a seperate prefix that changes with each iteration. This way,
seperately submitted user content displayed on the same page doesn't seperately submitted user content displayed on the same page doesn't
clobber each other. Ideal values are unique identifiers for the content it clobber each other. Ideal values are unique identifiers for the content it
represents (i.e. the id of the row in the database). Be sure to add a represents (i.e. the id of the row in the database). Be sure to add a
seperator (like an underscore) at the end. Warning: this directive will seperator (like an underscore) at the end. Warning: this directive will
not work unless %Attr.IDPrefix is set to a non-empty value! not work unless %Attr.IDPrefix is set to a non-empty value!
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,31 +1,31 @@
AutoFormat.AutoParagraph AutoFormat.AutoParagraph
TYPE: bool TYPE: bool
VERSION: 2.0.1 VERSION: 2.0.1
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive turns on auto-paragraphing, where double newlines are This directive turns on auto-paragraphing, where double newlines are
converted in to paragraphs whenever possible. Auto-paragraphing: converted in to paragraphs whenever possible. Auto-paragraphing:
</p> </p>
<ul> <ul>
<li>Always applies to inline elements or text in the root node,</li> <li>Always applies to inline elements or text in the root node,</li>
<li>Applies to inline elements or text with double newlines in nodes <li>Applies to inline elements or text with double newlines in nodes
that allow paragraph tags,</li> that allow paragraph tags,</li>
<li>Applies to double newlines in paragraph tags</li> <li>Applies to double newlines in paragraph tags</li>
</ul> </ul>
<p> <p>
<code>p</code> tags must be allowed for this directive to take effect. <code>p</code> tags must be allowed for this directive to take effect.
We do not use <code>br</code> tags for paragraphing, as that is We do not use <code>br</code> tags for paragraphing, as that is
semantically incorrect. semantically incorrect.
</p> </p>
<p> <p>
To prevent auto-paragraphing as a content-producer, refrain from using To prevent auto-paragraphing as a content-producer, refrain from using
double-newlines except to specify a new paragraph or in contexts where double-newlines except to specify a new paragraph or in contexts where
it has special meaning (whitespace usually has no meaning except in it has special meaning (whitespace usually has no meaning except in
tags like <code>pre</code>, so this should not be difficult.) To prevent tags like <code>pre</code>, so this should not be difficult.) To prevent
the paragraphing of inline text adjacent to block elements, wrap them the paragraphing of inline text adjacent to block elements, wrap them
in <code>div</code> tags (the behavior is slightly different outside of in <code>div</code> tags (the behavior is slightly different outside of
the root node.) the root node.)
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
AutoFormat.Custom AutoFormat.Custom
TYPE: list TYPE: list
VERSION: 2.0.1 VERSION: 2.0.1
DEFAULT: array() DEFAULT: array()
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive can be used to add custom auto-format injectors. This directive can be used to add custom auto-format injectors.
Specify an array of injector names (class name minus the prefix) Specify an array of injector names (class name minus the prefix)
or concrete implementations. Injector class must exist. or concrete implementations. Injector class must exist.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
AutoFormat.DisplayLinkURI AutoFormat.DisplayLinkURI
TYPE: bool TYPE: bool
VERSION: 3.2.0 VERSION: 3.2.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive turns on the in-text display of URIs in &lt;a&gt; tags, and disables This directive turns on the in-text display of URIs in &lt;a&gt; tags, and disables
those links. For example, <a href="http://example.com">example</a> becomes those links. For example, <a href="http://example.com">example</a> becomes
example (<a>http://example.com</a>). example (<a>http://example.com</a>).
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
AutoFormat.Linkify AutoFormat.Linkify
TYPE: bool TYPE: bool
VERSION: 2.0.1 VERSION: 2.0.1
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive turns on linkification, auto-linking http, ftp and This directive turns on linkification, auto-linking http, ftp and
https URLs. <code>a</code> tags with the <code>href</code> attribute https URLs. <code>a</code> tags with the <code>href</code> attribute
must be allowed. must be allowed.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
AutoFormat.PurifierLinkify.DocURL AutoFormat.PurifierLinkify.DocURL
TYPE: string TYPE: string
VERSION: 2.0.1 VERSION: 2.0.1
DEFAULT: '#%s' DEFAULT: '#%s'
ALIASES: AutoFormatParam.PurifierLinkifyDocURL ALIASES: AutoFormatParam.PurifierLinkifyDocURL
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Location of configuration documentation to link to, let %s substitute Location of configuration documentation to link to, let %s substitute
into the configuration's namespace and directive names sans the percent into the configuration's namespace and directive names sans the percent
sign. sign.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
AutoFormat.PurifierLinkify AutoFormat.PurifierLinkify
TYPE: bool TYPE: bool
VERSION: 2.0.1 VERSION: 2.0.1
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Internal auto-formatter that converts configuration directives in Internal auto-formatter that converts configuration directives in
syntax <a>%Namespace.Directive</a> to links. <code>a</code> tags syntax <a>%Namespace.Directive</a> to links. <code>a</code> tags
with the <code>href</code> attribute must be allowed. with the <code>href</code> attribute must be allowed.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -0,0 +1,14 @@
AutoFormat.RemoveEmpty.Predicate
TYPE: hash
VERSION: 4.7.0
DEFAULT: array('colgroup' => array(), 'th' => array(), 'td' => array(), 'iframe' => array('src'))
--DESCRIPTION--
<p>
Given that an element has no contents, it will be removed by default, unless
this predicate dictates otherwise. The predicate can either be an associative
map from tag name to list of attributes that must be present for the element
to be considered preserved: thus, the default always preserves <code>colgroup</code>,
<code>th</code> and <code>td</code>, and also <code>iframe</code> if it
has a <code>src</code>.
</p>
--# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions
TYPE: lookup TYPE: lookup
VERSION: 4.0.0 VERSION: 4.0.0
DEFAULT: array('td' => true, 'th' => true) DEFAULT: array('td' => true, 'th' => true)
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
When %AutoFormat.RemoveEmpty and %AutoFormat.RemoveEmpty.RemoveNbsp When %AutoFormat.RemoveEmpty and %AutoFormat.RemoveEmpty.RemoveNbsp
are enabled, this directive defines what HTML elements should not be are enabled, this directive defines what HTML elements should not be
removede if they have only a non-breaking space in them. removede if they have only a non-breaking space in them.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,15 +1,15 @@
AutoFormat.RemoveEmpty.RemoveNbsp AutoFormat.RemoveEmpty.RemoveNbsp
TYPE: bool TYPE: bool
VERSION: 4.0.0 VERSION: 4.0.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
When enabled, HTML Purifier will treat any elements that contain only When enabled, HTML Purifier will treat any elements that contain only
non-breaking spaces as well as regular whitespace as empty, and remove non-breaking spaces as well as regular whitespace as empty, and remove
them when %AutoForamt.RemoveEmpty is enabled. them when %AutoForamt.RemoveEmpty is enabled.
</p> </p>
<p> <p>
See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements
that don't have this behavior applied to them. that don't have this behavior applied to them.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,46 +1,46 @@
AutoFormat.RemoveEmpty AutoFormat.RemoveEmpty
TYPE: bool TYPE: bool
VERSION: 3.2.0 VERSION: 3.2.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
When enabled, HTML Purifier will attempt to remove empty elements that When enabled, HTML Purifier will attempt to remove empty elements that
contribute no semantic information to the document. The following types contribute no semantic information to the document. The following types
of nodes will be removed: of nodes will be removed:
</p> </p>
<ul><li> <ul><li>
Tags with no attributes and no content, and that are not empty Tags with no attributes and no content, and that are not empty
elements (remove <code>&lt;a&gt;&lt;/a&gt;</code> but not elements (remove <code>&lt;a&gt;&lt;/a&gt;</code> but not
<code>&lt;br /&gt;</code>), and <code>&lt;br /&gt;</code>), and
</li> </li>
<li> <li>
Tags with no content, except for:<ul> Tags with no content, except for:<ul>
<li>The <code>colgroup</code> element, or</li> <li>The <code>colgroup</code> element, or</li>
<li> <li>
Elements with the <code>id</code> or <code>name</code> attribute, Elements with the <code>id</code> or <code>name</code> attribute,
when those attributes are permitted on those elements. when those attributes are permitted on those elements.
</li> </li>
</ul></li> </ul></li>
</ul> </ul>
<p> <p>
Please be very careful when using this functionality; while it may not Please be very careful when using this functionality; while it may not
seem that empty elements contain useful information, they can alter the seem that empty elements contain useful information, they can alter the
layout of a document given appropriate styling. This directive is most layout of a document given appropriate styling. This directive is most
useful when you are processing machine-generated HTML, please avoid using useful when you are processing machine-generated HTML, please avoid using
it on regular user HTML. it on regular user HTML.
</p> </p>
<p> <p>
Elements that contain only whitespace will be treated as empty. Non-breaking Elements that contain only whitespace will be treated as empty. Non-breaking
spaces, however, do not count as whitespace. See spaces, however, do not count as whitespace. See
%AutoFormat.RemoveEmpty.RemoveNbsp for alternate behavior. %AutoFormat.RemoveEmpty.RemoveNbsp for alternate behavior.
</p> </p>
<p> <p>
This algorithm is not perfect; you may still notice some empty tags, This algorithm is not perfect; you may still notice some empty tags,
particularly if a node had elements, but those elements were later removed particularly if a node had elements, but those elements were later removed
because they were not permitted in that context, or tags that, after because they were not permitted in that context, or tags that, after
being auto-closed by another tag, where empty. This is for safety reasons being auto-closed by another tag, where empty. This is for safety reasons
to prevent clever code from breaking validation. The general rule of thumb: to prevent clever code from breaking validation. The general rule of thumb:
if a tag looked empty on the way in, it will get removed; if HTML Purifier if a tag looked empty on the way in, it will get removed; if HTML Purifier
made it empty, it will stay. made it empty, it will stay.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
AutoFormat.RemoveSpansWithoutAttributes AutoFormat.RemoveSpansWithoutAttributes
TYPE: bool TYPE: bool
VERSION: 4.0.1 VERSION: 4.0.1
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive causes <code>span</code> tags without any attributes This directive causes <code>span</code> tags without any attributes
to be removed. It will also remove spans that had all attributes to be removed. It will also remove spans that had all attributes
removed during processing. removed during processing.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,8 +1,8 @@
CSS.AllowImportant CSS.AllowImportant
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
VERSION: 3.1.0 VERSION: 3.1.0
--DESCRIPTION-- --DESCRIPTION--
This parameter determines whether or not !important cascade modifiers should This parameter determines whether or not !important cascade modifiers should
be allowed in user CSS. If false, !important will stripped. be allowed in user CSS. If false, !important will stripped.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
CSS.AllowTricky CSS.AllowTricky
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
VERSION: 3.1.0 VERSION: 3.1.0
--DESCRIPTION-- --DESCRIPTION--
This parameter determines whether or not to allow "tricky" CSS properties and This parameter determines whether or not to allow "tricky" CSS properties and
values. Tricky CSS properties/values can drastically modify page layout or values. Tricky CSS properties/values can drastically modify page layout or
be used for deceptive practices but do not directly constitute a security risk. be used for deceptive practices but do not directly constitute a security risk.
For example, <code>display:none;</code> is considered a tricky property that For example, <code>display:none;</code> is considered a tricky property that
will only be allowed if this directive is set to true. will only be allowed if this directive is set to true.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
CSS.AllowedFonts CSS.AllowedFonts
TYPE: lookup/null TYPE: lookup/null
VERSION: 4.3.0 VERSION: 4.3.0
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Allows you to manually specify a set of allowed fonts. If Allows you to manually specify a set of allowed fonts. If
<code>NULL</code>, all fonts are allowed. This directive <code>NULL</code>, all fonts are allowed. This directive
affects generic names (serif, sans-serif, monospace, cursive, affects generic names (serif, sans-serif, monospace, cursive,
fantasy) as well as specific font families. fantasy) as well as specific font families.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,18 +1,18 @@
CSS.AllowedProperties CSS.AllowedProperties
TYPE: lookup/null TYPE: lookup/null
VERSION: 3.1.0 VERSION: 3.1.0
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
If HTML Purifier's style attributes set is unsatisfactory for your needs, If HTML Purifier's style attributes set is unsatisfactory for your needs,
you can overload it with your own list of tags to allow. Note that this you can overload it with your own list of tags to allow. Note that this
method is subtractive: it does its job by taking away from HTML Purifier method is subtractive: it does its job by taking away from HTML Purifier
usual feature set, so you cannot add an attribute that HTML Purifier never usual feature set, so you cannot add an attribute that HTML Purifier never
supported in the first place. supported in the first place.
</p> </p>
<p> <p>
<strong>Warning:</strong> If another directive conflicts with the <strong>Warning:</strong> If another directive conflicts with the
elements here, <em>that</em> directive will win and override. elements here, <em>that</em> directive will win and override.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
CSS.DefinitionRev CSS.DefinitionRev
TYPE: int TYPE: int
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: 1 DEFAULT: 1
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Revision identifier for your custom definition. See Revision identifier for your custom definition. See
%HTML.DefinitionRev for details. %HTML.DefinitionRev for details.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,13 +1,13 @@
CSS.ForbiddenProperties CSS.ForbiddenProperties
TYPE: lookup TYPE: lookup
VERSION: 4.2.0 VERSION: 4.2.0
DEFAULT: array() DEFAULT: array()
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This is the logical inverse of %CSS.AllowedProperties, and it will This is the logical inverse of %CSS.AllowedProperties, and it will
override that directive or any other directive. If possible, override that directive or any other directive. If possible,
%CSS.AllowedProperties is recommended over this directive, %CSS.AllowedProperties is recommended over this directive,
because it can sometimes be difficult to tell whether or not you've because it can sometimes be difficult to tell whether or not you've
forbidden all of the CSS properties you truly would like to disallow. forbidden all of the CSS properties you truly would like to disallow.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,16 +1,16 @@
CSS.MaxImgLength CSS.MaxImgLength
TYPE: string/null TYPE: string/null
DEFAULT: '1200px' DEFAULT: '1200px'
VERSION: 3.1.1 VERSION: 3.1.1
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This parameter sets the maximum allowed length on <code>img</code> tags, This parameter sets the maximum allowed length on <code>img</code> tags,
effectively the <code>width</code> and <code>height</code> properties. effectively the <code>width</code> and <code>height</code> properties.
Only absolute units of measurement (in, pt, pc, mm, cm) and pixels (px) are allowed. This is Only absolute units of measurement (in, pt, pc, mm, cm) and pixels (px) are allowed. This is
in place to prevent imagecrash attacks, disable with null at your own risk. in place to prevent imagecrash attacks, disable with null at your own risk.
This directive is similar to %HTML.MaxImgLength, and both should be This directive is similar to %HTML.MaxImgLength, and both should be
concurrently edited, although there are concurrently edited, although there are
subtle differences in the input format (the CSS max is a number with subtle differences in the input format (the CSS max is a number with
a unit). a unit).
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,10 +1,10 @@
CSS.Proprietary CSS.Proprietary
TYPE: bool TYPE: bool
VERSION: 3.0.0 VERSION: 3.0.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Whether or not to allow safe, proprietary CSS values. Whether or not to allow safe, proprietary CSS values.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,9 +1,9 @@
CSS.Trusted CSS.Trusted
TYPE: bool TYPE: bool
VERSION: 4.2.1 VERSION: 4.2.1
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
Indicates whether or not the user's CSS input is trusted or not. If the Indicates whether or not the user's CSS input is trusted or not. If the
input is trusted, a more expansive set of allowed properties. See input is trusted, a more expansive set of allowed properties. See
also %HTML.Trusted. also %HTML.Trusted.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,14 +1,14 @@
Cache.DefinitionImpl Cache.DefinitionImpl
TYPE: string/null TYPE: string/null
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: 'Serializer' DEFAULT: 'Serializer'
--DESCRIPTION-- --DESCRIPTION--
This directive defines which method to use when caching definitions, This directive defines which method to use when caching definitions,
the complex data-type that makes HTML Purifier tick. Set to null the complex data-type that makes HTML Purifier tick. Set to null
to disable caching (not recommended, as you will see a definite to disable caching (not recommended, as you will see a definite
performance degradation). performance degradation).
--ALIASES-- --ALIASES--
Core.DefinitionCache Core.DefinitionCache
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,13 +1,13 @@
Cache.SerializerPath Cache.SerializerPath
TYPE: string/null TYPE: string/null
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Absolute path with no trailing slash to store serialized definitions in. Absolute path with no trailing slash to store serialized definitions in.
Default is within the Default is within the
HTML Purifier library inside DefinitionCache/Serializer. This HTML Purifier library inside DefinitionCache/Serializer. This
path must be writable by the webserver. path must be writable by the webserver.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,11 +1,11 @@
Cache.SerializerPermissions Cache.SerializerPermissions
TYPE: int TYPE: int
VERSION: 4.3.0 VERSION: 4.3.0
DEFAULT: 0755 DEFAULT: 0755
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Directory permissions of the files and directories created inside Directory permissions of the files and directories created inside
the DefinitionCache/Serializer or other custom serializer path. the DefinitionCache/Serializer or other custom serializer path.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,18 +1,18 @@
Core.AggressivelyFixLt Core.AggressivelyFixLt
TYPE: bool TYPE: bool
VERSION: 2.1.0 VERSION: 2.1.0
DEFAULT: true DEFAULT: true
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive enables aggressive pre-filter fixes HTML Purifier can This directive enables aggressive pre-filter fixes HTML Purifier can
perform in order to ensure that open angled-brackets do not get killed perform in order to ensure that open angled-brackets do not get killed
during parsing stage. Enabling this will result in two preg_replace_callback during parsing stage. Enabling this will result in two preg_replace_callback
calls and at least two preg_replace calls for every HTML document parsed; calls and at least two preg_replace calls for every HTML document parsed;
if your users make very well-formed HTML, you can set this directive false. if your users make very well-formed HTML, you can set this directive false.
This has no effect when DirectLex is used. This has no effect when DirectLex is used.
</p> </p>
<p> <p>
<strong>Notice:</strong> This directive's default turned from false to true <strong>Notice:</strong> This directive's default turned from false to true
in HTML Purifier 3.2.0. in HTML Purifier 3.2.0.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -0,0 +1,16 @@
Core.AllowHostnameUnderscore
TYPE: bool
VERSION: 4.6.0
DEFAULT: false
--DESCRIPTION--
<p>
By RFC 1123, underscores are not permitted in host names.
(This is in contrast to the specification for DNS, RFC
2181, which allows underscores.)
However, most browsers do the right thing when faced with
an underscore in the host name, and so some poorly written
websites are written with the expectation this should work.
Setting this parameter to true relaxes our allowed character
check so that underscores are permitted.
</p>
--# vim: et sw=4 sts=4
@@ -1,12 +1,12 @@
Core.CollectErrors Core.CollectErrors
TYPE: bool TYPE: bool
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
Whether or not to collect errors found while filtering the document. This Whether or not to collect errors found while filtering the document. This
is a useful way to give feedback to your users. <strong>Warning:</strong> is a useful way to give feedback to your users. <strong>Warning:</strong>
Currently this feature is very patchy and experimental, with lots of Currently this feature is very patchy and experimental, with lots of
possible error messages not yet implemented. It will not cause any possible error messages not yet implemented. It will not cause any
problems, but it may not help your users either. problems, but it may not help your users either.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,29 +1,29 @@
Core.ColorKeywords Core.ColorKeywords
TYPE: hash TYPE: hash
VERSION: 2.0.0 VERSION: 2.0.0
--DEFAULT-- --DEFAULT--
array ( array (
'maroon' => '#800000', 'maroon' => '#800000',
'red' => '#FF0000', 'red' => '#FF0000',
'orange' => '#FFA500', 'orange' => '#FFA500',
'yellow' => '#FFFF00', 'yellow' => '#FFFF00',
'olive' => '#808000', 'olive' => '#808000',
'purple' => '#800080', 'purple' => '#800080',
'fuchsia' => '#FF00FF', 'fuchsia' => '#FF00FF',
'white' => '#FFFFFF', 'white' => '#FFFFFF',
'lime' => '#00FF00', 'lime' => '#00FF00',
'green' => '#008000', 'green' => '#008000',
'navy' => '#000080', 'navy' => '#000080',
'blue' => '#0000FF', 'blue' => '#0000FF',
'aqua' => '#00FFFF', 'aqua' => '#00FFFF',
'teal' => '#008080', 'teal' => '#008080',
'black' => '#000000', 'black' => '#000000',
'silver' => '#C0C0C0', 'silver' => '#C0C0C0',
'gray' => '#808080', 'gray' => '#808080',
) )
--DESCRIPTION-- --DESCRIPTION--
Lookup array of color names to six digit hexadecimal number corresponding Lookup array of color names to six digit hexadecimal number corresponding
to color, with preceding hash mark. Used when parsing colors. The lookup to color, with preceding hash mark. Used when parsing colors. The lookup
is done in a case-insensitive manner. is done in a case-insensitive manner.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,14 +1,14 @@
Core.ConvertDocumentToFragment Core.ConvertDocumentToFragment
TYPE: bool TYPE: bool
DEFAULT: true DEFAULT: true
--DESCRIPTION-- --DESCRIPTION--
This parameter determines whether or not the filter should convert This parameter determines whether or not the filter should convert
input that is a full document with html and body tags to a fragment input that is a full document with html and body tags to a fragment
of just the contents of a body tag. This parameter is simply something of just the contents of a body tag. This parameter is simply something
HTML Purifier can do during an edge-case: for most inputs, this HTML Purifier can do during an edge-case: for most inputs, this
processing is not necessary. processing is not necessary.
--ALIASES-- --ALIASES--
Core.AcceptFullDocuments Core.AcceptFullDocuments
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,17 +1,17 @@
Core.DirectLexLineNumberSyncInterval Core.DirectLexLineNumberSyncInterval
TYPE: int TYPE: int
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: 0 DEFAULT: 0
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
Specifies the number of tokens the DirectLex line number tracking Specifies the number of tokens the DirectLex line number tracking
implementations should process before attempting to resyncronize the implementations should process before attempting to resyncronize the
current line count by manually counting all previous new-lines. When current line count by manually counting all previous new-lines. When
at 0, this functionality is disabled. Lower values will decrease at 0, this functionality is disabled. Lower values will decrease
performance, and this is only strictly necessary if the counting performance, and this is only strictly necessary if the counting
algorithm is buggy (in which case you should report it as a bug). algorithm is buggy (in which case you should report it as a bug).
This has no effect when %Core.MaintainLineNumbers is disabled or DirectLex is This has no effect when %Core.MaintainLineNumbers is disabled or DirectLex is
not being used. not being used.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,14 +1,14 @@
Core.DisableExcludes Core.DisableExcludes
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
VERSION: 4.5.0 VERSION: 4.5.0
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive disables SGML-style exclusions, e.g. the exclusion of This directive disables SGML-style exclusions, e.g. the exclusion of
<code>&lt;object&gt;</code> in any descendant of a <code>&lt;object&gt;</code> in any descendant of a
<code>&lt;pre&gt;</code> tag. Disabling excludes will allow some <code>&lt;pre&gt;</code> tag. Disabling excludes will allow some
invalid documents to pass through HTML Purifier, but HTML Purifier invalid documents to pass through HTML Purifier, but HTML Purifier
will also be less likely to accidentally remove large documents during will also be less likely to accidentally remove large documents during
processing. processing.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,9 +1,9 @@
Core.EnableIDNA Core.EnableIDNA
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
VERSION: 4.4.0 VERSION: 4.4.0
--DESCRIPTION-- --DESCRIPTION--
Allows international domain names in URLs. This configuration option Allows international domain names in URLs. This configuration option
requires the PEAR Net_IDNA2 module to be installed. It operates by requires the PEAR Net_IDNA2 module to be installed. It operates by
punycoding any internationalized host names for maximum portability. punycoding any internationalized host names for maximum portability.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,15 +1,15 @@
Core.Encoding Core.Encoding
TYPE: istring TYPE: istring
DEFAULT: 'utf-8' DEFAULT: 'utf-8'
--DESCRIPTION-- --DESCRIPTION--
If for some reason you are unable to convert all webpages to UTF-8, you can If for some reason you are unable to convert all webpages to UTF-8, you can
use this directive as a stop-gap compatibility change to let HTML Purifier use this directive as a stop-gap compatibility change to let HTML Purifier
deal with non UTF-8 input. This technique has notable deficiencies: deal with non UTF-8 input. This technique has notable deficiencies:
absolutely no characters outside of the selected character encoding will be absolutely no characters outside of the selected character encoding will be
preserved, not even the ones that have been ampersand escaped (this is due preserved, not even the ones that have been ampersand escaped (this is due
to a UTF-8 specific <em>feature</em> that automatically resolves all to a UTF-8 specific <em>feature</em> that automatically resolves all
entities), making it pretty useless for anything except the most I18N-blind entities), making it pretty useless for anything except the most I18N-blind
applications, although %Core.EscapeNonASCIICharacters offers fixes this applications, although %Core.EscapeNonASCIICharacters offers fixes this
trouble with another tradeoff. This directive only accepts ISO-8859-1 if trouble with another tradeoff. This directive only accepts ISO-8859-1 if
iconv is not enabled. iconv is not enabled.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,10 +1,12 @@
Core.EscapeInvalidChildren Core.EscapeInvalidChildren
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
When true, a child is found that is not allowed in the context of the <p><strong>Warning:</strong> this configuration option is no longer does anything as of 4.6.0.</p>
parent element will be transformed into text as if it were ASCII. When
false, that element and all internal tags will be dropped, though text will <p>When true, a child is found that is not allowed in the context of the
be preserved. There is no option for dropping the element but preserving parent element will be transformed into text as if it were ASCII. When
child nodes. false, that element and all internal tags will be dropped, though text will
--# vim: et sw=4 sts=4 be preserved. There is no option for dropping the element but preserving
child nodes.</p>
--# vim: et sw=4 sts=4
@@ -1,7 +1,7 @@
Core.EscapeInvalidTags Core.EscapeInvalidTags
TYPE: bool TYPE: bool
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
When true, invalid tags will be written back to the document as plain text. When true, invalid tags will be written back to the document as plain text.
Otherwise, they are silently dropped. Otherwise, they are silently dropped.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,13 +1,13 @@
Core.EscapeNonASCIICharacters Core.EscapeNonASCIICharacters
TYPE: bool TYPE: bool
VERSION: 1.4.0 VERSION: 1.4.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
This directive overcomes a deficiency in %Core.Encoding by blindly This directive overcomes a deficiency in %Core.Encoding by blindly
converting all non-ASCII characters into decimal numeric entities before converting all non-ASCII characters into decimal numeric entities before
converting it to its native encoding. This means that even characters that converting it to its native encoding. This means that even characters that
can be expressed in the non-UTF-8 encoding will be entity-ized, which can can be expressed in the non-UTF-8 encoding will be entity-ized, which can
be a real downer for encodings like Big5. It also assumes that the ASCII be a real downer for encodings like Big5. It also assumes that the ASCII
repetoire is available, although this is the case for almost all encodings. repetoire is available, although this is the case for almost all encodings.
Anyway, use UTF-8! Anyway, use UTF-8!
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,19 +1,19 @@
Core.HiddenElements Core.HiddenElements
TYPE: lookup TYPE: lookup
--DEFAULT-- --DEFAULT--
array ( array (
'script' => true, 'script' => true,
'style' => true, 'style' => true,
) )
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This directive is a lookup array of elements which should have their This directive is a lookup array of elements which should have their
contents removed when they are not allowed by the HTML definition. contents removed when they are not allowed by the HTML definition.
For example, the contents of a <code>script</code> tag are not For example, the contents of a <code>script</code> tag are not
normally shown in a document, so if script tags are to be removed, normally shown in a document, so if script tags are to be removed,
their contents should be removed to. This is opposed to a <code>b</code> their contents should be removed to. This is opposed to a <code>b</code>
tag, which defines some presentational changes but does not hide its tag, which defines some presentational changes but does not hide its
contents. contents.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,10 +1,10 @@
Core.Language Core.Language
TYPE: string TYPE: string
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: 'en' DEFAULT: 'en'
--DESCRIPTION-- --DESCRIPTION--
ISO 639 language code for localizable things in HTML Purifier to use, ISO 639 language code for localizable things in HTML Purifier to use,
which is mainly error reporting. There is currently only an English (en) which is mainly error reporting. There is currently only an English (en)
translation, so this directive is currently useless. translation, so this directive is currently useless.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,34 +1,34 @@
Core.LexerImpl Core.LexerImpl
TYPE: mixed/null TYPE: mixed/null
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
This parameter determines what lexer implementation can be used. The This parameter determines what lexer implementation can be used. The
valid values are: valid values are:
</p> </p>
<dl> <dl>
<dt><em>null</em></dt> <dt><em>null</em></dt>
<dd> <dd>
Recommended, the lexer implementation will be auto-detected based on Recommended, the lexer implementation will be auto-detected based on
your PHP-version and configuration. your PHP-version and configuration.
</dd> </dd>
<dt><em>string</em> lexer identifier</dt> <dt><em>string</em> lexer identifier</dt>
<dd> <dd>
This is a slim way of manually overridding the implementation. This is a slim way of manually overridding the implementation.
Currently recognized values are: DOMLex (the default PHP5 Currently recognized values are: DOMLex (the default PHP5
implementation) implementation)
and DirectLex (the default PHP4 implementation). Only use this if and DirectLex (the default PHP4 implementation). Only use this if
you know what you are doing: usually, the auto-detection will you know what you are doing: usually, the auto-detection will
manage things for cases you aren't even aware of. manage things for cases you aren't even aware of.
</dd> </dd>
<dt><em>object</em> lexer instance</dt> <dt><em>object</em> lexer instance</dt>
<dd> <dd>
Super-advanced: you can specify your own, custom, implementation that Super-advanced: you can specify your own, custom, implementation that
implements the interface defined by <code>HTMLPurifier_Lexer</code>. implements the interface defined by <code>HTMLPurifier_Lexer</code>.
I may remove this option simply because I don't expect anyone I may remove this option simply because I don't expect anyone
to use it. to use it.
</dd> </dd>
</dl> </dl>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -1,16 +1,16 @@
Core.MaintainLineNumbers Core.MaintainLineNumbers
TYPE: bool/null TYPE: bool/null
VERSION: 2.0.0 VERSION: 2.0.0
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
<p> <p>
If true, HTML Purifier will add line number information to all tokens. If true, HTML Purifier will add line number information to all tokens.
This is useful when error reporting is turned on, but can result in This is useful when error reporting is turned on, but can result in
significant performance degradation and should not be used when significant performance degradation and should not be used when
unnecessary. This directive must be used with the DirectLex lexer, unnecessary. This directive must be used with the DirectLex lexer,
as the DOMLex lexer does not (yet) support this functionality. as the DOMLex lexer does not (yet) support this functionality.
If the value is null, an appropriate value will be selected based If the value is null, an appropriate value will be selected based
on other configuration. on other configuration.
</p> </p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4

Some files were not shown because too many files have changed in this diff Show More