Compare commits

..
9 Commits
79 changed files with 11895 additions and 7314 deletions

No files matched your search

-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),
+20 -20
View File
@@ -95,26 +95,26 @@ $sql = " insert into {$g5['board_table']}
bo_use_cert = '{$board[bo_use_cert]}', bo_use_cert = '{$board[bo_use_cert]}',
bo_use_sns = '{$board[bo_use_sns]}', bo_use_sns = '{$board[bo_use_sns]}',
bo_sort_field = '{$board['bo_sort_field']}', bo_sort_field = '{$board['bo_sort_field']}',
bo_1_subj = '{$board['bo_1_subj']}', bo_1_subj = '".addslashes($board['bo_1_subj'])."',
bo_2_subj = '{$board['bo_2_subj']}', bo_2_subj = '".addslashes($board['bo_2_subj'])."',
bo_3_subj = '{$board['bo_3_subj']}', bo_3_subj = '".addslashes($board['bo_3_subj'])."',
bo_4_subj = '{$board['bo_4_subj']}', bo_4_subj = '".addslashes($board['bo_4_subj'])."',
bo_5_subj = '{$board['bo_5_subj']}', bo_5_subj = '".addslashes($board['bo_5_subj'])."',
bo_6_subj = '{$board['bo_6_subj']}', bo_6_subj = '".addslashes($board['bo_6_subj'])."',
bo_7_subj = '{$board['bo_7_subj']}', bo_7_subj = '".addslashes($board['bo_7_subj'])."',
bo_8_subj = '{$board['bo_8_subj']}', bo_8_subj = '".addslashes($board['bo_8_subj'])."',
bo_9_subj = '{$board['bo_9_subj']}', bo_9_subj = '".addslashes($board['bo_9_subj'])."',
bo_10_subj = '{$board['bo_10_subj']}', bo_10_subj = '".addslashes($board['bo_10_subj'])."',
bo_1 = '{$board['bo_1']}', bo_1 = '".addslashes($board['bo_1'])."',
bo_2 = '{$board['bo_2']}', bo_2 = '".addslashes($board['bo_2'])."',
bo_3 = '{$board['bo_3']}', bo_3 = '".addslashes($board['bo_3'])."',
bo_4 = '{$board['bo_4']}', bo_4 = '".addslashes($board['bo_4'])."',
bo_5 = '{$board['bo_5']}', bo_5 = '".addslashes($board['bo_5'])."',
bo_6 = '{$board['bo_6']}', bo_6 = '".addslashes($board['bo_6'])."',
bo_7 = '{$board['bo_7']}', bo_7 = '".addslashes($board['bo_7'])."',
bo_8 = '{$board['bo_8']}', bo_8 = '".addslashes($board['bo_8'])."',
bo_9 = '{$board['bo_9']}', bo_9 = '".addslashes($board['bo_9'])."',
bo_10 = '{$board['bo_10']}' "; bo_10 = '".addslashes($board['bo_10'])."' ";
sql_query($sql, false); sql_query($sql, false);
// 게시판 폴더 생성 // 게시판 폴더 생성
+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.5');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음 // 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
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);
+24 -1
View File
@@ -22,7 +22,30 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
<section id="fregister_private"> <section id="fregister_private">
<h2>개인정보처리방침안내</h2> <h2>개인정보처리방침안내</h2>
<textarea readonly><?php echo get_text($config['cf_privacy']) ?></textarea> <div class="tbl_head01 tbl_wrap">
<table>
<caption>개인정보처리방침안내</caption>
<thead>
<tr>
<th>목적</th>
<th>항목</th>
<th>보유기간</th>
</tr>
</thead>
<tbody>
<tr>
<td>이용자 식별 및 본인여부 확인</td>
<td>아이디, 이름, 비밀번호</td>
<td>회원 탈퇴 시까지</td>
</tr>
<tr>
<td>고객서비스 이용에 관한 통지,<br>CS대응을 위한 이용자 식별</td>
<td>연락처 (이메일, 휴대전화번호)</td>
<td>회원 탈퇴 시까지</td>
</tr>
</tbody>
</table>
</div>
<fieldset class="fregister_agree"> <fieldset class="fregister_agree">
<label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label> <label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label>
<input type="checkbox" name="agree2" value="1" id="agree21"> <input type="checkbox" name="agree2" value="1" id="agree21">
+4
View File
@@ -80,6 +80,10 @@
.fregister_agree label {display:inline-block;margin-right:5px} .fregister_agree label {display:inline-block;margin-right:5px}
#fregister p {color:#e8180c;text-align:center} #fregister p {color:#e8180c;text-align:center}
#fregister .btn_confirm {margin:15px 0} #fregister .btn_confirm {margin:15px 0}
#fregister_private .tbl_head01 {margin:0}
#fregister_private .tbl_head01 th{;text-align:center;border:1px solid #d1dee2;width:33%}
#fregister_private .tbl_head01 td {border:1px solid #e9e9e9;background:#fff}
#fregister_private .tbl_head01 caption{position:absolute;font-size:0;line-height:0;overflow:hidden;top:0;color:#fff}
/* 회원가입 입력 */ /* 회원가입 입력 */
#fregisterform #reg_mb_email, #fregisterform .frm_address {width:100%} #fregisterform #reg_mb_email, #fregisterform .frm_address {width:100%}
File diff suppressed because it is too large. Load diff
@@ -7,7 +7,12 @@
class HTMLPurifier_ConfigSchema_Builder_ConfigSchema class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
{ {
public function build($interchange) { /**
* @param HTMLPurifier_ConfigSchema_Interchange $interchange
* @return HTMLPurifier_ConfigSchema
*/
public function build($interchange)
{
$schema = new HTMLPurifier_ConfigSchema(); $schema = new HTMLPurifier_ConfigSchema();
foreach ($interchange->directives as $d) { foreach ($interchange->directives as $d) {
$schema->add( $schema->add(
@@ -38,7 +43,6 @@ class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
$schema->postProcess(); $schema->postProcess();
return $schema; return $schema;
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -7,10 +7,21 @@
class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
{ {
/**
* @type HTMLPurifier_ConfigSchema_Interchange
*/
protected $interchange; protected $interchange;
/**
* @type string
*/
private $namespace; private $namespace;
protected function writeHTMLDiv($html) { /**
* @param string $html
*/
protected function writeHTMLDiv($html)
{
$this->startElement('div'); $this->startElement('div');
$purifier = HTMLPurifier::getInstance(); $purifier = HTMLPurifier::getInstance();
@@ -21,12 +32,23 @@ class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
$this->endElement(); // div $this->endElement(); // div
} }
protected function export($var) { /**
if ($var === array()) return 'array()'; * @param mixed $var
* @return string
*/
protected function export($var)
{
if ($var === array()) {
return 'array()';
}
return var_export($var, true); return var_export($var, true);
} }
public function build($interchange) { /**
* @param HTMLPurifier_ConfigSchema_Interchange $interchange
*/
public function build($interchange)
{
// global access, only use as last resort // global access, only use as last resort
$this->interchange = $interchange; $this->interchange = $interchange;
@@ -39,19 +61,26 @@ class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
$this->buildDirective($directive); $this->buildDirective($directive);
} }
if ($this->namespace) $this->endElement(); // namespace if ($this->namespace) {
$this->endElement();
} // namespace
$this->endElement(); // configdoc $this->endElement(); // configdoc
$this->flush(); $this->flush();
} }
public function buildDirective($directive) { /**
* @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
*/
public function buildDirective($directive)
{
// Kludge, although I suppose having a notion of a "root namespace" // Kludge, although I suppose having a notion of a "root namespace"
// certainly makes things look nicer when documentation is built. // certainly makes things look nicer when documentation is built.
// Depends on things being sorted. // Depends on things being sorted.
if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) { if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) {
if ($this->namespace) $this->endElement(); // namespace if ($this->namespace) {
$this->endElement();
} // namespace
$this->namespace = $directive->id->getRootNamespace(); $this->namespace = $directive->id->getRootNamespace();
$this->startElement('namespace'); $this->startElement('namespace');
$this->writeAttribute('id', $this->namespace); $this->writeAttribute('id', $this->namespace);
@@ -64,43 +93,52 @@ class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
$this->writeElement('name', $directive->id->getDirective()); $this->writeElement('name', $directive->id->getDirective());
$this->startElement('aliases'); $this->startElement('aliases');
foreach ($directive->aliases as $alias) $this->writeElement('alias', $alias->toString()); foreach ($directive->aliases as $alias) {
$this->writeElement('alias', $alias->toString());
}
$this->endElement(); // aliases $this->endElement(); // aliases
$this->startElement('constraints'); $this->startElement('constraints');
if ($directive->version) $this->writeElement('version', $directive->version); if ($directive->version) {
$this->startElement('type'); $this->writeElement('version', $directive->version);
if ($directive->typeAllowsNull) $this->writeAttribute('allow-null', 'yes'); }
$this->text($directive->type); $this->startElement('type');
$this->endElement(); // type if ($directive->typeAllowsNull) {
if ($directive->allowed) { $this->writeAttribute('allow-null', 'yes');
$this->startElement('allowed'); }
foreach ($directive->allowed as $value => $x) $this->writeElement('value', $value); $this->text($directive->type);
$this->endElement(); // allowed $this->endElement(); // type
if ($directive->allowed) {
$this->startElement('allowed');
foreach ($directive->allowed as $value => $x) {
$this->writeElement('value', $value);
} }
$this->writeElement('default', $this->export($directive->default)); $this->endElement(); // allowed
$this->writeAttribute('xml:space', 'preserve'); }
if ($directive->external) { $this->writeElement('default', $this->export($directive->default));
$this->startElement('external'); $this->writeAttribute('xml:space', 'preserve');
foreach ($directive->external as $project) $this->writeElement('project', $project); if ($directive->external) {
$this->endElement(); $this->startElement('external');
foreach ($directive->external as $project) {
$this->writeElement('project', $project);
} }
$this->endElement();
}
$this->endElement(); // constraints $this->endElement(); // constraints
if ($directive->deprecatedVersion) { if ($directive->deprecatedVersion) {
$this->startElement('deprecated'); $this->startElement('deprecated');
$this->writeElement('version', $directive->deprecatedVersion); $this->writeElement('version', $directive->deprecatedVersion);
$this->writeElement('use', $directive->deprecatedUse->toString()); $this->writeElement('use', $directive->deprecatedUse->toString());
$this->endElement(); // deprecated $this->endElement(); // deprecated
} }
$this->startElement('description'); $this->startElement('description');
$this->writeHTMLDiv($directive->description); $this->writeHTMLDiv($directive->description);
$this->endElement(); // description $this->endElement(); // description
$this->endElement(); // directive $this->endElement(); // directive
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -10,18 +10,23 @@ 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)
* @type HTMLPurifier_ConfigSchema_Interchange_Directive[]
*/ */
public $directives = array(); public $directives = array();
/** /**
* Adds a directive array to $directives * Adds a directive array to $directives
* @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
* @throws HTMLPurifier_ConfigSchema_Exception
*/ */
public function addDirective($directive) { public function addDirective($directive)
{
if (isset($this->directives[$i = $directive->id->toString()])) { if (isset($this->directives[$i = $directive->id->toString()])) {
throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'"); throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
} }
@@ -32,11 +37,11 @@ class HTMLPurifier_ConfigSchema_Interchange
* Convenience function to perform standard validation. Throws exception * Convenience function to perform standard validation. Throws exception
* on failed validation. * on failed validation.
*/ */
public function validate() { public function validate()
{
$validator = new HTMLPurifier_ConfigSchema_Validator(); $validator = new HTMLPurifier_ConfigSchema_Validator();
return $validator->validate($this); return $validator->validate($this);
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -7,71 +7,83 @@ 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'.
* @type string
*/ */
public $type; public $type;
/** /**
* Default value, e.g. 3 or 'DefaultVal'. * Default value, e.g. 3 or 'DefaultVal'.
* @type mixed
*/ */
public $default; public $default;
/** /**
* HTML description. * HTML description.
* @type string
*/ */
public $description; public $description;
/** /**
* Boolean whether or not null is allowed as a value. * Whether or not null is allowed as a value.
* @type bool
*/ */
public $typeAllowsNull = false; public $typeAllowsNull = false;
/** /**
* Lookup table of allowed scalar values, e.g. array('allowed' => true). * Lookup table of allowed scalar values.
* e.g. array('allowed' => true).
* Null if all values are allowed. * Null if all values are allowed.
* @type array
*/ */
public $allowed; public $allowed;
/** /**
* List of aliases for the directive, * List of aliases for the directive.
* e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))). * e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))).
* @type HTMLPurifier_ConfigSchema_Interchange_Id[]
*/ */
public $aliases = array(); public $aliases = array();
/** /**
* Hash of value aliases, e.g. array('alt' => 'real'). Null if value * Hash of value aliases, e.g. array('alt' => 'real'). Null if value
* aliasing is disabled (necessary for non-scalar types). * aliasing is disabled (necessary for non-scalar types).
* @type array
*/ */
public $valueAliases; public $valueAliases;
/** /**
* Version of HTML Purifier the directive was introduced, e.g. '1.3.1'. * Version of HTML Purifier the directive was introduced, e.g. '1.3.1'.
* Null if the directive has always existed. * Null if the directive has always existed.
* @type string
*/ */
public $version; public $version;
/** /**
* ID of directive that supercedes this old directive, is an instance * ID of directive that supercedes this old directive.
* of HTMLPurifier_ConfigSchema_Interchange_Id. Null if not deprecated. * Null if not deprecated.
* @type HTMLPurifier_ConfigSchema_Interchange_Id
*/ */
public $deprecatedUse; public $deprecatedUse;
/** /**
* Version of HTML Purifier this directive was deprecated. Null if not * Version of HTML Purifier this directive was deprecated. Null if not
* deprecated. * deprecated.
* @type string
*/ */
public $deprecatedVersion; public $deprecatedVersion;
/** /**
* List of external projects this directive depends on, e.g. array('CSSTidy'). * List of external projects this directive depends on, e.g. array('CSSTidy').
* @type array
*/ */
public $external = array(); public $external = array();
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -6,32 +6,53 @@
class HTMLPurifier_ConfigSchema_Interchange_Id class HTMLPurifier_ConfigSchema_Interchange_Id
{ {
/**
* @type string
*/
public $key; public $key;
public function __construct($key) { /**
* @param string $key
*/
public function __construct($key)
{
$this->key = $key; $this->key = $key;
} }
/** /**
* @return string
* @warning This is NOT magic, to ensure that people don't abuse SPL and * @warning This is NOT magic, to ensure that people don't abuse SPL and
* cause problems for PHP 5.0 support. * cause problems for PHP 5.0 support.
*/ */
public function toString() { public function toString()
{
return $this->key; return $this->key;
} }
public function getRootNamespace() { /**
* @return string
*/
public function getRootNamespace()
{
return substr($this->key, 0, strpos($this->key, ".")); return substr($this->key, 0, strpos($this->key, "."));
} }
public function getDirective() { /**
* @return string
*/
public function getDirective()
{
return substr($this->key, strpos($this->key, ".") + 1); return substr($this->key, strpos($this->key, ".") + 1);
} }
public static function make($id) { /**
* @param string $id
* @return HTMLPurifier_ConfigSchema_Interchange_Id
*/
public static function make($id)
{
return new HTMLPurifier_ConfigSchema_Interchange_Id($id); return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -5,21 +5,39 @@ 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) { /**
* @param HTMLPurifier_VarParser $varParser
*/
public function __construct($varParser = null)
{
$this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native(); $this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native();
} }
public static function buildFromDirectory($dir = null) { /**
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); * @param string $dir
* @return HTMLPurifier_ConfigSchema_Interchange
*/
public static function buildFromDirectory($dir = null)
{
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
$interchange = new HTMLPurifier_ConfigSchema_Interchange(); $interchange = new HTMLPurifier_ConfigSchema_Interchange();
return $builder->buildDir($interchange, $dir); return $builder->buildDir($interchange, $dir);
} }
public function buildDir($interchange, $dir = null) { /**
if (!$dir) $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema'; * @param HTMLPurifier_ConfigSchema_Interchange $interchange
* @param string $dir
* @return HTMLPurifier_ConfigSchema_Interchange
*/
public function buildDir($interchange, $dir = null)
{
if (!$dir) {
$dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema';
}
if (file_exists($dir . '/info.ini')) { if (file_exists($dir . '/info.ini')) {
$info = parse_ini_file($dir . '/info.ini'); $info = parse_ini_file($dir . '/info.ini');
$interchange->name = $info['name']; $interchange->name = $info['name'];
@@ -39,24 +57,30 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
foreach ($files as $file) { foreach ($files as $file) {
$this->buildFile($interchange, $dir . '/' . $file); $this->buildFile($interchange, $dir . '/' . $file);
} }
return $interchange; return $interchange;
} }
public function buildFile($interchange, $file) { /**
* @param HTMLPurifier_ConfigSchema_Interchange $interchange
* @param string $file
*/
public function buildFile($interchange, $file)
{
$parser = new HTMLPurifier_StringHashParser(); $parser = new HTMLPurifier_StringHashParser();
$this->build( $this->build(
$interchange, $interchange,
new HTMLPurifier_StringHash( $parser->parseFile($file) ) new HTMLPurifier_StringHash($parser->parseFile($file))
); );
} }
/** /**
* Builds an interchange object based on a hash. * Builds an interchange object based on a hash.
* @param $interchange HTMLPurifier_ConfigSchema_Interchange object to build * @param HTMLPurifier_ConfigSchema_Interchange $interchange HTMLPurifier_ConfigSchema_Interchange object to build
* @param $hash HTMLPurifier_ConfigSchema_StringHash source data * @param HTMLPurifier_StringHash $hash source data
* @throws HTMLPurifier_ConfigSchema_Exception
*/ */
public function build($interchange, $hash) { public function build($interchange, $hash)
{
if (!$hash instanceof HTMLPurifier_StringHash) { if (!$hash instanceof HTMLPurifier_StringHash) {
$hash = new HTMLPurifier_StringHash($hash); $hash = new HTMLPurifier_StringHash($hash);
} }
@@ -75,7 +99,13 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
$this->_findUnused($hash); $this->_findUnused($hash);
} }
public function buildDirective($interchange, $hash) { /**
* @param HTMLPurifier_ConfigSchema_Interchange $interchange
* @param HTMLPurifier_StringHash $hash
* @throws HTMLPurifier_ConfigSchema_Exception
*/
public function buildDirective($interchange, $hash)
{
$directive = new HTMLPurifier_ConfigSchema_Interchange_Directive(); $directive = new HTMLPurifier_ConfigSchema_Interchange_Directive();
// These are required elements: // These are required elements:
@@ -84,7 +114,9 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
if (isset($hash['TYPE'])) { if (isset($hash['TYPE'])) {
$type = explode('/', $hash->offsetGet('TYPE')); $type = explode('/', $hash->offsetGet('TYPE'));
if (isset($type[1])) $directive->typeAllowsNull = true; if (isset($type[1])) {
$directive->typeAllowsNull = true;
}
$directive->type = $type[0]; $directive->type = $type[0];
} else { } else {
throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined"); throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
@@ -92,7 +124,11 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
if (isset($hash['DEFAULT'])) { if (isset($hash['DEFAULT'])) {
try { try {
$directive->default = $this->varParser->parse($hash->offsetGet('DEFAULT'), $directive->type, $directive->typeAllowsNull); $directive->default = $this->varParser->parse(
$hash->offsetGet('DEFAULT'),
$directive->type,
$directive->typeAllowsNull
);
} catch (HTMLPurifier_VarParserException $e) { } catch (HTMLPurifier_VarParserException $e) {
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'"); throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'");
} }
@@ -139,34 +175,45 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
/** /**
* Evaluates an array PHP code string without array() wrapper * Evaluates an array PHP code string without array() wrapper
* @param string $contents
*/ */
protected function evalArray($contents) { protected function evalArray($contents)
return eval('return array('. $contents .');'); {
return eval('return array(' . $contents . ');');
} }
/** /**
* Converts an array list into a lookup array. * Converts an array list into a lookup array.
* @param array $array
* @return array
*/ */
protected function lookup($array) { protected function lookup($array)
{
$ret = array(); $ret = array();
foreach ($array as $val) $ret[$val] = true; foreach ($array as $val) {
$ret[$val] = true;
}
return $ret; return $ret;
} }
/** /**
* Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id * Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id
* object based on a string Id. * object based on a string Id.
* @param string $id
* @return HTMLPurifier_ConfigSchema_Interchange_Id
*/ */
protected function id($id) { protected function id($id)
{
return HTMLPurifier_ConfigSchema_Interchange_Id::make($id); return HTMLPurifier_ConfigSchema_Interchange_Id::make($id);
} }
/** /**
* Triggers errors for any unused keys passed in the hash; such keys * Triggers errors for any unused keys passed in the hash; such keys
* may indicate typos, missing values, etc. * may indicate typos, missing values, etc.
* @param $hash Instance of ConfigSchema_StringHash to check. * @param HTMLPurifier_StringHash $hash Hash to check.
*/ */
protected function _findUnused($hash) { protected function _findUnused($hash)
{
$accessed = $hash->getAccessed(); $accessed = $hash->getAccessed();
foreach ($hash as $k => $v) { foreach ($hash as $k => $v) {
if (!isset($accessed[$k])) { if (!isset($accessed[$k])) {
@@ -174,7 +221,6 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
} }
} }
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -12,36 +12,48 @@ class HTMLPurifier_ConfigSchema_Validator
{ {
/** /**
* Easy to access global objects. * @type HTMLPurifier_ConfigSchema_Interchange
*/ */
protected $interchange, $aliases; protected $interchange;
/**
* @type array
*/
protected $aliases;
/** /**
* Context-stack to provide easy to read error messages. * Context-stack to provide easy to read error messages.
* @type array
*/ */
protected $context = array(); protected $context = array();
/** /**
* HTMLPurifier_VarParser to test default's type. * to test default's type.
* @type HTMLPurifier_VarParser
*/ */
protected $parser; protected $parser;
public function __construct() { public function __construct()
{
$this->parser = new HTMLPurifier_VarParser(); $this->parser = new HTMLPurifier_VarParser();
} }
/** /**
* Validates a fully-formed interchange object. Throws an * Validates a fully-formed interchange object.
* HTMLPurifier_ConfigSchema_Exception if there's a problem. * @param HTMLPurifier_ConfigSchema_Interchange $interchange
* @return bool
*/ */
public function validate($interchange) { public function validate($interchange)
{
$this->interchange = $interchange; $this->interchange = $interchange;
$this->aliases = array(); $this->aliases = array();
// PHP is a bit lax with integer <=> string conversions in // PHP is a bit lax with integer <=> string conversions in
// arrays, so we don't use the identical !== comparison // arrays, so we don't use the identical !== comparison
foreach ($interchange->directives as $i => $directive) { foreach ($interchange->directives as $i => $directive) {
$id = $directive->id->toString(); $id = $directive->id->toString();
if ($i != $id) $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'"); if ($i != $id) {
$this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
}
$this->validateDirective($directive); $this->validateDirective($directive);
} }
return true; return true;
@@ -49,8 +61,10 @@ class HTMLPurifier_ConfigSchema_Validator
/** /**
* Validates a HTMLPurifier_ConfigSchema_Interchange_Id object. * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
* @param HTMLPurifier_ConfigSchema_Interchange_Id $id
*/ */
public function validateId($id) { public function validateId($id)
{
$id_string = $id->toString(); $id_string = $id->toString();
$this->context[] = "id '$id_string'"; $this->context[] = "id '$id_string'";
if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) { if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
@@ -67,8 +81,10 @@ class HTMLPurifier_ConfigSchema_Validator
/** /**
* Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object. * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
* @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
*/ */
public function validateDirective($d) { public function validateDirective($d)
{
$id = $d->id->toString(); $id = $d->id->toString();
$this->context[] = "directive '$id'"; $this->context[] = "directive '$id'";
$this->validateId($d->id); $this->validateId($d->id);
@@ -108,9 +124,13 @@ class HTMLPurifier_ConfigSchema_Validator
/** /**
* Extra validation if $allowed member variable of * Extra validation if $allowed member variable of
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined. * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
* @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
*/ */
public function validateDirectiveAllowed($d) { public function validateDirectiveAllowed($d)
if (is_null($d->allowed)) return; {
if (is_null($d->allowed)) {
return;
}
$this->with($d, 'allowed') $this->with($d, 'allowed')
->assertNotEmpty() ->assertNotEmpty()
->assertIsLookup(); // handled by InterchangeBuilder ->assertIsLookup(); // handled by InterchangeBuilder
@@ -119,7 +139,9 @@ class HTMLPurifier_ConfigSchema_Validator
} }
$this->context[] = 'allowed'; $this->context[] = 'allowed';
foreach ($d->allowed as $val => $x) { foreach ($d->allowed as $val => $x) {
if (!is_string($val)) $this->error("value $val", 'must be a string'); if (!is_string($val)) {
$this->error("value $val", 'must be a string');
}
} }
array_pop($this->context); array_pop($this->context);
} }
@@ -127,15 +149,23 @@ class HTMLPurifier_ConfigSchema_Validator
/** /**
* Extra validation if $valueAliases member variable of * Extra validation if $valueAliases member variable of
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined. * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
* @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
*/ */
public function validateDirectiveValueAliases($d) { public function validateDirectiveValueAliases($d)
if (is_null($d->valueAliases)) return; {
if (is_null($d->valueAliases)) {
return;
}
$this->with($d, 'valueAliases') $this->with($d, 'valueAliases')
->assertIsArray(); // handled by InterchangeBuilder ->assertIsArray(); // handled by InterchangeBuilder
$this->context[] = 'valueAliases'; $this->context[] = 'valueAliases';
foreach ($d->valueAliases as $alias => $real) { foreach ($d->valueAliases as $alias => $real) {
if (!is_string($alias)) $this->error("alias $alias", 'must be a string'); if (!is_string($alias)) {
if (!is_string($real)) $this->error("alias target $real from alias '$alias'", 'must be a string'); $this->error("alias $alias", 'must be a string');
}
if (!is_string($real)) {
$this->error("alias target $real from alias '$alias'", 'must be a string');
}
if ($alias === $real) { if ($alias === $real) {
$this->error("alias '$alias'", "must not be an alias to itself"); $this->error("alias '$alias'", "must not be an alias to itself");
} }
@@ -155,8 +185,10 @@ class HTMLPurifier_ConfigSchema_Validator
/** /**
* Extra validation if $aliases member variable of * Extra validation if $aliases member variable of
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined. * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
* @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
*/ */
public function validateDirectiveAliases($d) { public function validateDirectiveAliases($d)
{
$this->with($d, 'aliases') $this->with($d, 'aliases')
->assertIsArray(); // handled by InterchangeBuilder ->assertIsArray(); // handled by InterchangeBuilder
$this->context[] = 'aliases'; $this->context[] = 'aliases';
@@ -180,27 +212,37 @@ class HTMLPurifier_ConfigSchema_Validator
/** /**
* Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom * Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
* for validating simple member variables of objects. * for validating simple member variables of objects.
* @param $obj
* @param $member
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/ */
protected function with($obj, $member) { protected function with($obj, $member)
{
return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member); return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
} }
/** /**
* Emits an error, providing helpful context. * Emits an error, providing helpful context.
* @throws HTMLPurifier_ConfigSchema_Exception
*/ */
protected function error($target, $msg) { protected function error($target, $msg)
if ($target !== false) $prefix = ucfirst($target) . ' in ' . $this->getFormattedContext(); {
else $prefix = ucfirst($this->getFormattedContext()); if ($target !== false) {
$prefix = ucfirst($target) . ' in ' . $this->getFormattedContext();
} else {
$prefix = ucfirst($this->getFormattedContext());
}
throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg)); throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
} }
/** /**
* Returns a formatted context string. * Returns a formatted context string.
* @return string
*/ */
protected function getFormattedContext() { protected function getFormattedContext()
{
return implode(' in ', array_reverse($this->context)); return implode(' in ', array_reverse($this->context));
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -8,59 +8,123 @@
*/ */
class HTMLPurifier_ConfigSchema_ValidatorAtom class HTMLPurifier_ConfigSchema_ValidatorAtom
{ {
/**
* @type string
*/
protected $context;
protected $context, $obj, $member, $contents; /**
* @type object
*/
protected $obj;
public function __construct($context, $obj, $member) { /**
$this->context = $context; * @type string
$this->obj = $obj; */
$this->member = $member; protected $member;
$this->contents =& $obj->$member;
/**
* @type mixed
*/
protected $contents;
public function __construct($context, $obj, $member)
{
$this->context = $context;
$this->obj = $obj;
$this->member = $member;
$this->contents =& $obj->$member;
} }
public function assertIsString() { /**
if (!is_string($this->contents)) $this->error('must be a string'); * @return HTMLPurifier_ConfigSchema_ValidatorAtom
return $this; */
} public function assertIsString()
{
public function assertIsBool() { if (!is_string($this->contents)) {
if (!is_bool($this->contents)) $this->error('must be a boolean'); $this->error('must be a string');
return $this;
}
public function assertIsArray() {
if (!is_array($this->contents)) $this->error('must be an array');
return $this;
}
public function assertNotNull() {
if ($this->contents === null) $this->error('must not be null');
return $this;
}
public function assertAlnum() {
$this->assertIsString();
if (!ctype_alnum($this->contents)) $this->error('must be alphanumeric');
return $this;
}
public function assertNotEmpty() {
if (empty($this->contents)) $this->error('must not be empty');
return $this;
}
public function assertIsLookup() {
$this->assertIsArray();
foreach ($this->contents as $v) {
if ($v !== true) $this->error('must be a lookup array');
} }
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 assertIsBool()
{
if (!is_bool($this->contents)) {
$this->error('must be a boolean');
}
return $this;
} }
/**
* @return HTMLPurifier_ConfigSchema_ValidatorAtom
*/
public function assertIsArray()
{
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 // 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
@@ -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
@@ -2,9 +2,11 @@ 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>
<p>When true, a child is found that is not allowed in the context of the
parent element will be transformed into text as if it were ASCII. When 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 false, that element and all internal tags will be dropped, though text will
be preserved. There is no option for dropping the element but preserving be preserved. There is no option for dropping the element but preserving
child nodes. child nodes.</p>
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -4,6 +4,6 @@ VERSION: 2.0.1
DEFAULT: NULL DEFAULT: NULL
--DESCRIPTION-- --DESCRIPTION--
A custom doctype for power-users who defined there own document A custom doctype for power-users who defined their own document
type. This directive only applies when %HTML.Doctype is blank. type. This directive only applies when %HTML.Doctype is blank.
--# vim: et sw=4 sts=4 --# vim: et sw=4 sts=4
@@ -11,7 +11,7 @@ DEFAULT: NULL
to check if a URI has passed through HTML Purifier with this line: to check if a URI has passed through HTML Purifier with this line:
</p> </p>
<pre>$checksum === sha1($secret_key . ':' . $url)</pre> <pre>$checksum === hash_hmac("sha256", $url, $secret_key)</pre>
<p> <p>
If the output is TRUE, the redirector script should accept the URI. If the output is TRUE, the redirector script should accept the URI.
@@ -4,7 +4,9 @@
// understand how to interpret this filter if it's a static method. // understand how to interpret this filter if it's a static method.
// It's all really silly, but if we go this route it might be reasonable // It's all really silly, but if we go this route it might be reasonable
// to coalesce all of these methods into one. // to coalesce all of these methods into one.
function htmlpurifier_filter_extractstyleblocks_muteerrorhandler() {} function htmlpurifier_filter_extractstyleblocks_muteerrorhandler()
{
}
/** /**
* This filter extracts <style> blocks from input HTML, cleans them up * This filter extracts <style> blocks from input HTML, cleans them up
@@ -22,38 +24,77 @@ function htmlpurifier_filter_extractstyleblocks_muteerrorhandler() {}
*/ */
class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
{ {
/**
* @type string
*/
public $name = 'ExtractStyleBlocks'; public $name = 'ExtractStyleBlocks';
/**
* @type array
*/
private $_styleMatches = array(); private $_styleMatches = array();
/**
* @type csstidy
*/
private $_tidy; private $_tidy;
/**
* @type HTMLPurifier_AttrDef_HTML_ID
*/
private $_id_attrdef; private $_id_attrdef;
/**
* @type HTMLPurifier_AttrDef_CSS_Ident
*/
private $_class_attrdef; private $_class_attrdef;
/**
* @type HTMLPurifier_AttrDef_Enum
*/
private $_enum_attrdef; private $_enum_attrdef;
public function __construct() { public function __construct()
{
$this->_tidy = new csstidy(); $this->_tidy = new csstidy();
$this->_tidy->set_cfg('lowercase_s', false); $this->_tidy->set_cfg('lowercase_s', false);
$this->_id_attrdef = new HTMLPurifier_AttrDef_HTML_ID(true); $this->_id_attrdef = new HTMLPurifier_AttrDef_HTML_ID(true);
$this->_class_attrdef = new HTMLPurifier_AttrDef_CSS_Ident(); $this->_class_attrdef = new HTMLPurifier_AttrDef_CSS_Ident();
$this->_enum_attrdef = new HTMLPurifier_AttrDef_Enum(array('first-child', 'link', 'visited', 'active', 'hover', 'focus')); $this->_enum_attrdef = new HTMLPurifier_AttrDef_Enum(
array(
'first-child',
'link',
'visited',
'active',
'hover',
'focus'
)
);
} }
/** /**
* Save the contents of CSS blocks to style matches * Save the contents of CSS blocks to style matches
* @param $matches preg_replace style $matches array * @param array $matches preg_replace style $matches array
*/ */
protected function styleCallback($matches) { protected function styleCallback($matches)
{
$this->_styleMatches[] = $matches[1]; $this->_styleMatches[] = $matches[1];
} }
/** /**
* Removes inline <style> tags from HTML, saves them for later use * Removes inline <style> tags from HTML, saves them for later use
* @param string $html
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return string
* @todo Extend to indicate non-text/css style blocks * @todo Extend to indicate non-text/css style blocks
*/ */
public function preFilter($html, $config, $context) { public function preFilter($html, $config, $context)
{
$tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl'); $tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl');
if ($tidy !== null) $this->_tidy = $tidy; if ($tidy !== null) {
$this->_tidy = $tidy;
}
$html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html); $html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
$style_blocks = $this->_styleMatches; $style_blocks = $this->_styleMatches;
$this->_styleMatches = array(); // reset $this->_styleMatches = array(); // reset
@@ -69,12 +110,14 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
/** /**
* Takes CSS (the stuff found in <style>) and cleans it. * Takes CSS (the stuff found in <style>) and cleans it.
* @warning Requires CSSTidy <http://csstidy.sourceforge.net/> * @warning Requires CSSTidy <http://csstidy.sourceforge.net/>
* @param $css CSS styling to clean * @param string $css CSS styling to clean
* @param $config Instance of HTMLPurifier_Config * @param HTMLPurifier_Config $config
* @param $context Instance of HTMLPurifier_Context * @param HTMLPurifier_Context $context
* @return Cleaned CSS * @throws HTMLPurifier_Exception
* @return string Cleaned CSS
*/ */
public function cleanCSS($css, $config, $context) { public function cleanCSS($css, $config, $context)
{
// prepare scope // prepare scope
$scope = $config->get('Filter.ExtractStyleBlocks.Scope'); $scope = $config->get('Filter.ExtractStyleBlocks.Scope');
if ($scope !== null) { if ($scope !== null) {
@@ -102,7 +145,9 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
$new_decls = array(); $new_decls = array();
foreach ($decls as $selector => $style) { foreach ($decls as $selector => $style) {
$selector = trim($selector); $selector = trim($selector);
if ($selector === '') continue; // should not happen if ($selector === '') {
continue;
} // should not happen
// Parse the selector // Parse the selector
// Here is the relevant part of the CSS grammar: // Here is the relevant part of the CSS grammar:
// //
@@ -174,7 +219,7 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
// delimiters // delimiters
$nsel = null; $nsel = null;
$delim = null; // guaranteed to be non-null after $delim = null; // guaranteed to be non-null after
// two loop iterations // two loop iterations
for ($i = 0, $c = count($basic_selectors); $i < $c; $i++) { for ($i = 0, $c = count($basic_selectors); $i < $c; $i++) {
$x = $basic_selectors[$i]; $x = $basic_selectors[$i];
if ($i % 2) { if ($i % 2) {
@@ -189,7 +234,7 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
$components = preg_split('/([#.:])/', $x, -1, PREG_SPLIT_DELIM_CAPTURE); $components = preg_split('/([#.:])/', $x, -1, PREG_SPLIT_DELIM_CAPTURE);
$sdelim = null; $sdelim = null;
$nx = null; $nx = null;
for ($j = 0, $cc = count($components); $j < $cc; $j ++) { for ($j = 0, $cc = count($components); $j < $cc; $j++) {
$y = $components[$j]; $y = $components[$j];
if ($j === 0) { if ($j === 0) {
if ($y === '*' || isset($html_definition->info[$y = strtolower($y)])) { if ($y === '*' || isset($html_definition->info[$y = strtolower($y)])) {
@@ -249,7 +294,9 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
} }
} }
} }
if (empty($new_selectors)) continue; if (empty($new_selectors)) {
continue;
}
$selector = implode(', ', $new_selectors); $selector = implode(', ', $new_selectors);
foreach ($style as $name => $value) { foreach ($style as $name => $value) {
if (!isset($css_definition->info[$name])) { if (!isset($css_definition->info[$name])) {
@@ -258,8 +305,11 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
} }
$def = $css_definition->info[$name]; $def = $css_definition->info[$name];
$ret = $def->validate($value, $config, $context); $ret = $def->validate($value, $config, $context);
if ($ret === false) unset($style[$name]); if ($ret === false) {
else $style[$name] = $ret; unset($style[$name]);
} else {
$style[$name] = $ret;
}
} }
$new_decls[$selector] = $style; $new_decls[$selector] = $style;
} }
@@ -276,14 +326,13 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
// that no funny business occurs (i.e. </style> in a font-family prop). // that no funny business occurs (i.e. </style> in a font-family prop).
if ($config->get('Filter.ExtractStyleBlocks.Escaping')) { if ($config->get('Filter.ExtractStyleBlocks.Escaping')) {
$css = str_replace( $css = str_replace(
array('<', '>', '&'), array('<', '>', '&'),
array('\3C ', '\3E ', '\26 '), array('\3C ', '\3E ', '\26 '),
$css $css
); );
} }
return $css; return $css;
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -3,36 +3,62 @@
class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter
{ {
/**
* @type string
*/
public $name = 'YouTube'; public $name = 'YouTube';
public function preFilter($html, $config, $context) { /**
$pre_regex = '#<object[^>]+>.+?'. * @param string $html
'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s'; * @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return string
*/
public function preFilter($html, $config, $context)
{
$pre_regex = '#<object[^>]+>.+?' .
'(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s';
$pre_replace = '<span class="youtube-embed">\1</span>'; $pre_replace = '<span class="youtube-embed">\1</span>';
return preg_replace($pre_regex, $pre_replace, $html); return preg_replace($pre_regex, $pre_replace, $html);
} }
public function postFilter($html, $config, $context) { /**
* @param string $html
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return string
*/
public function postFilter($html, $config, $context)
{
$post_regex = '#<span class="youtube-embed">((?:v|cp)/[A-Za-z0-9\-_=]+)</span>#'; $post_regex = '#<span class="youtube-embed">((?:v|cp)/[A-Za-z0-9\-_=]+)</span>#';
return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html); return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
} }
protected function armorUrl($url) { /**
* @param $url
* @return string
*/
protected function armorUrl($url)
{
return str_replace('--', '-&#45;', $url); return str_replace('--', '-&#45;', $url);
} }
protected function postFilterCallback($matches) { /**
* @param array $matches
* @return string
*/
protected function postFilterCallback($matches)
{
$url = $this->armorUrl($matches[1]); $url = $this->armorUrl($matches[1]);
return '<object width="425" height="350" type="application/x-shockwave-flash" '. return '<object width="425" height="350" type="application/x-shockwave-flash" ' .
'data="http://www.youtube.com/'.$url.'">'. 'data="//www.youtube.com/' . $url . '">' .
'<param name="movie" value="http://www.youtube.com/'.$url.'"></param>'. '<param name="movie" value="//www.youtube.com/' . $url . '"></param>' .
'<!--[if IE]>'. '<!--[if IE]>' .
'<embed src="http://www.youtube.com/'.$url.'"'. '<embed src="//www.youtube.com/' . $url . '"' .
'type="application/x-shockwave-flash"'. 'type="application/x-shockwave-flash"' .
'wmode="transparent" width="425" height="350" />'. 'wmode="transparent" width="425" height="350" />' .
'<![endif]-->'. '<![endif]-->' .
'</object>'; '</object>';
} }
} }
@@ -4,9 +4,6 @@
class HTMLPurifier_Language_en_x_test extends HTMLPurifier_Language class HTMLPurifier_Language_en_x_test extends HTMLPurifier_Language
{ {
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -4,60 +4,52 @@ $fallback = false;
$messages = array( $messages = array(
'HTMLPurifier' => 'HTML Purifier', 'HTMLPurifier' => 'HTML Purifier',
// for unit testing purposes // for unit testing purposes
'LanguageFactoryTest: Pizza' => 'Pizza', 'LanguageFactoryTest: Pizza' => 'Pizza',
'LanguageTest: List' => '$1', 'LanguageTest: List' => '$1',
'LanguageTest: Hash' => '$1.Keys; $1.Values', 'LanguageTest: Hash' => '$1.Keys; $1.Values',
'Item separator' => ', ',
'Item separator' => ', ', 'Item separator last' => ' and ', // non-Harvard style
'Item separator last' => ' and ', // non-Harvard style
'ErrorCollector: No errors' => 'No errors detected. However, because error reporting is still incomplete, there may have been errors that the error collector was not notified of; please inspect the output HTML carefully.',
'ErrorCollector: At line' => ' at line $line',
'ErrorCollector: Incidental errors' => 'Incidental errors',
'Lexer: Unclosed comment' => 'Unclosed comment',
'Lexer: Unescaped lt' => 'Unescaped less-than sign (<) should be &lt;',
'Lexer: Missing gt' => 'Missing greater-than sign (>), previous less-than sign (<) should be escaped',
'Lexer: Missing attribute key' => 'Attribute declaration has no key',
'Lexer: Missing end quote' => 'Attribute declaration has no end quote',
'Lexer: Extracted body' => 'Removed document metadata tags',
'Strategy_RemoveForeignElements: Tag transform' => '<$1> element transformed into $CurrentToken.Serialized',
'Strategy_RemoveForeignElements: Missing required attribute' => '$CurrentToken.Compact element missing required attribute $1',
'Strategy_RemoveForeignElements: Foreign element to text' => 'Unrecognized $CurrentToken.Serialized tag converted to text',
'Strategy_RemoveForeignElements: Foreign element removed' => 'Unrecognized $CurrentToken.Serialized tag removed',
'Strategy_RemoveForeignElements: Comment removed' => 'Comment containing "$CurrentToken.Data" removed',
'Strategy_RemoveForeignElements: Foreign meta element removed' => 'Unrecognized $CurrentToken.Serialized meta tag and all descendants removed',
'Strategy_RemoveForeignElements: Token removed to end' => 'Tags and text starting from $1 element where removed to end',
'Strategy_RemoveForeignElements: Trailing hyphen in comment removed' => 'Trailing hyphen(s) in comment removed',
'Strategy_RemoveForeignElements: Hyphens in comment collapsed' => 'Double hyphens in comments are not allowed, and were collapsed into single hyphens',
'Strategy_MakeWellFormed: Unnecessary end tag removed' => 'Unnecessary $CurrentToken.Serialized tag removed',
'Strategy_MakeWellFormed: Unnecessary end tag to text' => 'Unnecessary $CurrentToken.Serialized tag converted to text',
'Strategy_MakeWellFormed: Tag auto closed' => '$1.Compact started on line $1.Line auto-closed by $CurrentToken.Compact',
'Strategy_MakeWellFormed: Tag carryover' => '$1.Compact started on line $1.Line auto-continued into $CurrentToken.Compact',
'Strategy_MakeWellFormed: Stray end tag removed' => 'Stray $CurrentToken.Serialized tag removed',
'Strategy_MakeWellFormed: Stray end tag to text' => 'Stray $CurrentToken.Serialized tag converted to text',
'Strategy_MakeWellFormed: Tag closed by element end' => '$1.Compact tag started on line $1.Line closed by end of $CurrentToken.Serialized',
'Strategy_MakeWellFormed: Tag closed by document end' => '$1.Compact tag started on line $1.Line closed by end of document',
'Strategy_FixNesting: Node removed' => '$CurrentToken.Compact node removed',
'Strategy_FixNesting: Node excluded' => '$CurrentToken.Compact node removed due to descendant exclusion by ancestor element',
'Strategy_FixNesting: Node reorganized' => 'Contents of $CurrentToken.Compact node reorganized to enforce its content model',
'Strategy_FixNesting: Node contents removed' => 'Contents of $CurrentToken.Compact node removed',
'AttrValidator: Attributes transformed' => 'Attributes on $CurrentToken.Compact transformed from $1.Keys to $2.Keys',
'AttrValidator: Attribute removed' => '$CurrentAttr.Name attribute on $CurrentToken.Compact removed',
'ErrorCollector: No errors' => 'No errors detected. However, because error reporting is still incomplete, there may have been errors that the error collector was not notified of; please inspect the output HTML carefully.',
'ErrorCollector: At line' => ' at line $line',
'ErrorCollector: Incidental errors' => 'Incidental errors',
'Lexer: Unclosed comment' => 'Unclosed comment',
'Lexer: Unescaped lt' => 'Unescaped less-than sign (<) should be &lt;',
'Lexer: Missing gt' => 'Missing greater-than sign (>), previous less-than sign (<) should be escaped',
'Lexer: Missing attribute key' => 'Attribute declaration has no key',
'Lexer: Missing end quote' => 'Attribute declaration has no end quote',
'Lexer: Extracted body' => 'Removed document metadata tags',
'Strategy_RemoveForeignElements: Tag transform' => '<$1> element transformed into $CurrentToken.Serialized',
'Strategy_RemoveForeignElements: Missing required attribute' => '$CurrentToken.Compact element missing required attribute $1',
'Strategy_RemoveForeignElements: Foreign element to text' => 'Unrecognized $CurrentToken.Serialized tag converted to text',
'Strategy_RemoveForeignElements: Foreign element removed' => 'Unrecognized $CurrentToken.Serialized tag removed',
'Strategy_RemoveForeignElements: Comment removed' => 'Comment containing "$CurrentToken.Data" removed',
'Strategy_RemoveForeignElements: Foreign meta element removed' => 'Unrecognized $CurrentToken.Serialized meta tag and all descendants removed',
'Strategy_RemoveForeignElements: Token removed to end' => 'Tags and text starting from $1 element where removed to end',
'Strategy_RemoveForeignElements: Trailing hyphen in comment removed' => 'Trailing hyphen(s) in comment removed',
'Strategy_RemoveForeignElements: Hyphens in comment collapsed' => 'Double hyphens in comments are not allowed, and were collapsed into single hyphens',
'Strategy_MakeWellFormed: Unnecessary end tag removed' => 'Unnecessary $CurrentToken.Serialized tag removed',
'Strategy_MakeWellFormed: Unnecessary end tag to text' => 'Unnecessary $CurrentToken.Serialized tag converted to text',
'Strategy_MakeWellFormed: Tag auto closed' => '$1.Compact started on line $1.Line auto-closed by $CurrentToken.Compact',
'Strategy_MakeWellFormed: Tag carryover' => '$1.Compact started on line $1.Line auto-continued into $CurrentToken.Compact',
'Strategy_MakeWellFormed: Stray end tag removed' => 'Stray $CurrentToken.Serialized tag removed',
'Strategy_MakeWellFormed: Stray end tag to text' => 'Stray $CurrentToken.Serialized tag converted to text',
'Strategy_MakeWellFormed: Tag closed by element end' => '$1.Compact tag started on line $1.Line closed by end of $CurrentToken.Serialized',
'Strategy_MakeWellFormed: Tag closed by document end' => '$1.Compact tag started on line $1.Line closed by end of document',
'Strategy_FixNesting: Node removed' => '$CurrentToken.Compact node removed',
'Strategy_FixNesting: Node excluded' => '$CurrentToken.Compact node removed due to descendant exclusion by ancestor element',
'Strategy_FixNesting: Node reorganized' => 'Contents of $CurrentToken.Compact node reorganized to enforce its content model',
'Strategy_FixNesting: Node contents removed' => 'Contents of $CurrentToken.Compact node removed',
'AttrValidator: Attributes transformed' => 'Attributes on $CurrentToken.Compact transformed from $1.Keys to $2.Keys',
'AttrValidator: Attribute removed' => '$CurrentAttr.Name attribute on $CurrentToken.Compact removed',
); );
$errorNames = array( $errorNames = array(
E_ERROR => 'Error', E_ERROR => 'Error',
E_WARNING => 'Warning', E_WARNING => 'Warning',
E_NOTICE => 'Notice' E_NOTICE => 'Notice'
); );
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
File diff suppressed because it is too large. Load diff
@@ -7,25 +7,30 @@ class HTMLPurifier_Printer
{ {
/** /**
* Instance of HTMLPurifier_Generator for HTML generation convenience funcs * For HTML generation convenience funcs.
* @type HTMLPurifier_Generator
*/ */
protected $generator; protected $generator;
/** /**
* Instance of HTMLPurifier_Config, for easy access * For easy access.
* @type HTMLPurifier_Config
*/ */
protected $config; protected $config;
/** /**
* Initialize $generator. * Initialize $generator.
*/ */
public function __construct() { public function __construct()
{
} }
/** /**
* Give generator necessary configuration if possible * Give generator necessary configuration if possible
* @param HTMLPurifier_Config $config
*/ */
public function prepareGenerator($config) { public function prepareGenerator($config)
{
$all = $config->getAll(); $all = $config->getAll();
$context = new HTMLPurifier_Context(); $context = new HTMLPurifier_Context();
$this->generator = new HTMLPurifier_Generator($config, $context); $this->generator = new HTMLPurifier_Generator($config, $context);
@@ -39,45 +44,62 @@ class HTMLPurifier_Printer
/** /**
* Returns a start tag * Returns a start tag
* @param $tag Tag name * @param string $tag Tag name
* @param $attr Attribute array * @param array $attr Attribute array
* @return string
*/ */
protected function start($tag, $attr = array()) { protected function start($tag, $attr = array())
{
return $this->generator->generateFromToken( return $this->generator->generateFromToken(
new HTMLPurifier_Token_Start($tag, $attr ? $attr : array()) new HTMLPurifier_Token_Start($tag, $attr ? $attr : array())
); );
} }
/** /**
* Returns an end teg * Returns an end tag
* @param $tag Tag name * @param string $tag Tag name
* @return string
*/ */
protected function end($tag) { protected function end($tag)
{
return $this->generator->generateFromToken( return $this->generator->generateFromToken(
new HTMLPurifier_Token_End($tag) new HTMLPurifier_Token_End($tag)
); );
} }
/** /**
* Prints a complete element with content inside * Prints a complete element with content inside
* @param $tag Tag name * @param string $tag Tag name
* @param $contents Element contents * @param string $contents Element contents
* @param $attr Tag attributes * @param array $attr Tag attributes
* @param $escape Bool whether or not to escape contents * @param bool $escape whether or not to escape contents
* @return string
*/ */
protected function element($tag, $contents, $attr = array(), $escape = true) { protected function element($tag, $contents, $attr = array(), $escape = true)
{
return $this->start($tag, $attr) . return $this->start($tag, $attr) .
($escape ? $this->escape($contents) : $contents) . ($escape ? $this->escape($contents) : $contents) .
$this->end($tag); $this->end($tag);
} }
protected function elementEmpty($tag, $attr = array()) { /**
* @param string $tag
* @param array $attr
* @return string
*/
protected function elementEmpty($tag, $attr = array())
{
return $this->generator->generateFromToken( return $this->generator->generateFromToken(
new HTMLPurifier_Token_Empty($tag, $attr) new HTMLPurifier_Token_Empty($tag, $attr)
); );
} }
protected function text($text) { /**
* @param string $text
* @return string
*/
protected function text($text)
{
return $this->generator->generateFromToken( return $this->generator->generateFromToken(
new HTMLPurifier_Token_Text($text) new HTMLPurifier_Token_Text($text)
); );
@@ -85,24 +107,29 @@ class HTMLPurifier_Printer
/** /**
* Prints a simple key/value row in a table. * Prints a simple key/value row in a table.
* @param $name Key * @param string $name Key
* @param $value Value * @param mixed $value Value
* @return string
*/ */
protected function row($name, $value) { protected function row($name, $value)
if (is_bool($value)) $value = $value ? 'On' : 'Off'; {
if (is_bool($value)) {
$value = $value ? 'On' : 'Off';
}
return return
$this->start('tr') . "\n" . $this->start('tr') . "\n" .
$this->element('th', $name) . "\n" . $this->element('th', $name) . "\n" .
$this->element('td', $value) . "\n" . $this->element('td', $value) . "\n" .
$this->end('tr') $this->end('tr');
;
} }
/** /**
* Escapes a string for HTML output. * Escapes a string for HTML output.
* @param $string String to escape * @param string $string String to escape
* @return string
*/ */
protected function escape($string) { protected function escape($string)
{
$string = HTMLPurifier_Encoder::cleanUTF8($string); $string = HTMLPurifier_Encoder::cleanUTF8($string);
$string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8'); $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
return $string; return $string;
@@ -110,32 +137,46 @@ class HTMLPurifier_Printer
/** /**
* Takes a list of strings and turns them into a single list * Takes a list of strings and turns them into a single list
* @param $array List of strings * @param string[] $array List of strings
* @param $polite Bool whether or not to add an end before the last * @param bool $polite Bool whether or not to add an end before the last
* @return string
*/ */
protected function listify($array, $polite = false) { protected function listify($array, $polite = false)
if (empty($array)) return 'None'; {
if (empty($array)) {
return 'None';
}
$ret = ''; $ret = '';
$i = count($array); $i = count($array);
foreach ($array as $value) { foreach ($array as $value) {
$i--; $i--;
$ret .= $value; $ret .= $value;
if ($i > 0 && !($polite && $i == 1)) $ret .= ', '; if ($i > 0 && !($polite && $i == 1)) {
if ($polite && $i == 1) $ret .= 'and '; $ret .= ', ';
}
if ($polite && $i == 1) {
$ret .= 'and ';
}
} }
return $ret; return $ret;
} }
/** /**
* Retrieves the class of an object without prefixes, as well as metadata * Retrieves the class of an object without prefixes, as well as metadata
* @param $obj Object to determine class of * @param object $obj Object to determine class of
* @param $prefix Further prefix to remove * @param string $sec_prefix Further prefix to remove
* @return string
*/ */
protected function getClass($obj, $sec_prefix = '') { protected function getClass($obj, $sec_prefix = '')
{
static $five = null; static $five = null;
if ($five === null) $five = version_compare(PHP_VERSION, '5', '>='); if ($five === null) {
$five = version_compare(PHP_VERSION, '5', '>=');
}
$prefix = 'HTMLPurifier_' . $sec_prefix; $prefix = 'HTMLPurifier_' . $sec_prefix;
if (!$five) $prefix = strtolower($prefix); if (!$five) {
$prefix = strtolower($prefix);
}
$class = str_replace($prefix, '', get_class($obj)); $class = str_replace($prefix, '', get_class($obj));
$lclass = strtolower($class); $lclass = strtolower($class);
$class .= '('; $class .= '(';
@@ -164,13 +205,14 @@ class HTMLPurifier_Printer
break; break;
case 'css_importantdecorator': case 'css_importantdecorator':
$class .= $this->getClass($obj->def, $sec_prefix); $class .= $this->getClass($obj->def, $sec_prefix);
if ($obj->allow) $class .= ', !important'; if ($obj->allow) {
$class .= ', !important';
}
break; break;
} }
$class .= ')'; $class .= ')';
return $class; return $class;
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -2,10 +2,17 @@
class HTMLPurifier_Printer_CSSDefinition extends HTMLPurifier_Printer class HTMLPurifier_Printer_CSSDefinition extends HTMLPurifier_Printer
{ {
/**
* @type HTMLPurifier_CSSDefinition
*/
protected $def; protected $def;
public function render($config) { /**
* @param HTMLPurifier_Config $config
* @return string
*/
public function render($config)
{
$this->def = $config->getCSSDefinition(); $this->def = $config->getCSSDefinition();
$ret = ''; $ret = '';
@@ -32,7 +39,6 @@ class HTMLPurifier_Printer_CSSDefinition extends HTMLPurifier_Printer
return $ret; return $ret;
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
@@ -7,17 +7,20 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
{ {
/** /**
* Printers for specific fields * Printers for specific fields.
* @type HTMLPurifier_Printer[]
*/ */
protected $fields = array(); protected $fields = array();
/** /**
* Documentation URL, can have fragment tagged on end * Documentation URL, can have fragment tagged on end.
* @type string
*/ */
protected $docURL; protected $docURL;
/** /**
* Name of form element to stuff config in * Name of form element to stuff config in.
* @type string
*/ */
protected $name; protected $name;
@@ -25,24 +28,27 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
* Whether or not to compress directive names, clipping them off * Whether or not to compress directive names, clipping them off
* after a certain amount of letters. False to disable or integer letters * after a certain amount of letters. False to disable or integer letters
* before clipping. * before clipping.
* @type bool
*/ */
protected $compress = false; protected $compress = false;
/** /**
* @param $name Form element name for directives to be stuffed into * @param string $name Form element name for directives to be stuffed into
* @param $doc_url String documentation URL, will have fragment tagged on * @param string $doc_url String documentation URL, will have fragment tagged on
* @param $compress Integer max length before compressing a directive name, set to false to turn off * @param bool $compress Integer max length before compressing a directive name, set to false to turn off
*/ */
public function __construct( public function __construct(
$name, $doc_url = null, $compress = false $name,
$doc_url = null,
$compress = false
) { ) {
parent::__construct(); parent::__construct();
$this->docURL = $doc_url; $this->docURL = $doc_url;
$this->name = $name; $this->name = $name;
$this->compress = $compress; $this->compress = $compress;
// initialize sub-printers // initialize sub-printers
$this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default(); $this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default();
$this->fields[HTMLPurifier_VarParser::BOOL] = new HTMLPurifier_Printer_ConfigForm_bool(); $this->fields[HTMLPurifier_VarParser::BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
} }
/** /**
@@ -50,32 +56,42 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
* @param $cols Integer columns of textarea, null to use default * @param $cols Integer columns of textarea, null to use default
* @param $rows Integer rows of textarea, null to use default * @param $rows Integer rows of textarea, null to use default
*/ */
public function setTextareaDimensions($cols = null, $rows = null) { public function setTextareaDimensions($cols = null, $rows = null)
if ($cols) $this->fields['default']->cols = $cols; {
if ($rows) $this->fields['default']->rows = $rows; if ($cols) {
$this->fields['default']->cols = $cols;
}
if ($rows) {
$this->fields['default']->rows = $rows;
}
} }
/** /**
* Retrieves styling, in case it is not accessible by webserver * Retrieves styling, in case it is not accessible by webserver
*/ */
public static function getCSS() { public static function getCSS()
{
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css'); return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');
} }
/** /**
* Retrieves JavaScript, in case it is not accessible by webserver * Retrieves JavaScript, in case it is not accessible by webserver
*/ */
public static function getJavaScript() { public static function getJavaScript()
{
return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js'); return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js');
} }
/** /**
* Returns HTML output for a configuration form * Returns HTML output for a configuration form
* @param $config Configuration object of current form state, or an array * @param HTMLPurifier_Config|array $config Configuration object of current form state, or an array
* where [0] has an HTML namespace and [1] is being rendered. * where [0] has an HTML namespace and [1] is being rendered.
* @param $allowed Optional namespace(s) and directives to restrict form to. * @param array|bool $allowed Optional namespace(s) and directives to restrict form to.
* @param bool $render_controls
* @return string
*/ */
public function render($config, $allowed = true, $render_controls = true) { public function render($config, $allowed = true, $render_controls = true)
{
if (is_array($config) && isset($config[0])) { if (is_array($config) && isset($config[0])) {
$gen_config = $config[0]; $gen_config = $config[0];
$config = $config[1]; $config = $config[1];
@@ -91,29 +107,29 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
$all = array(); $all = array();
foreach ($allowed as $key) { foreach ($allowed as $key) {
list($ns, $directive) = $key; list($ns, $directive) = $key;
$all[$ns][$directive] = $config->get($ns .'.'. $directive); $all[$ns][$directive] = $config->get($ns . '.' . $directive);
} }
$ret = ''; $ret = '';
$ret .= $this->start('table', array('class' => 'hp-config')); $ret .= $this->start('table', array('class' => 'hp-config'));
$ret .= $this->start('thead'); $ret .= $this->start('thead');
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Directive', array('class' => 'hp-directive')); $ret .= $this->element('th', 'Directive', array('class' => 'hp-directive'));
$ret .= $this->element('th', 'Value', array('class' => 'hp-value')); $ret .= $this->element('th', 'Value', array('class' => 'hp-value'));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->end('thead'); $ret .= $this->end('thead');
foreach ($all as $ns => $directives) { foreach ($all as $ns => $directives) {
$ret .= $this->renderNamespace($ns, $directives); $ret .= $this->renderNamespace($ns, $directives);
} }
if ($render_controls) { if ($render_controls) {
$ret .= $this->start('tbody'); $ret .= $this->start('tbody');
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->start('td', array('colspan' => 2, 'class' => 'controls')); $ret .= $this->start('td', array('colspan' => 2, 'class' => 'controls'));
$ret .= $this->elementEmpty('input', array('type' => 'submit', 'value' => 'Submit')); $ret .= $this->elementEmpty('input', array('type' => 'submit', 'value' => 'Submit'));
$ret .= '[<a href="?">Reset</a>]'; $ret .= '[<a href="?">Reset</a>]';
$ret .= $this->end('td'); $ret .= $this->end('td');
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->end('tbody'); $ret .= $this->end('tbody');
} }
$ret .= $this->end('table'); $ret .= $this->end('table');
return $ret; return $ret;
@@ -122,13 +138,15 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
/** /**
* Renders a single namespace * Renders a single namespace
* @param $ns String namespace name * @param $ns String namespace name
* @param $directive Associative array of directives to values * @param array $directives array of directives to values
* @return string
*/ */
protected function renderNamespace($ns, $directives) { protected function renderNamespace($ns, $directives)
{
$ret = ''; $ret = '';
$ret .= $this->start('tbody', array('class' => 'namespace')); $ret .= $this->start('tbody', array('class' => 'namespace'));
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', $ns, array('colspan' => 2)); $ret .= $this->element('th', $ns, array('colspan' => 2));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->end('tbody'); $ret .= $this->end('tbody');
$ret .= $this->start('tbody'); $ret .= $this->start('tbody');
@@ -139,40 +157,44 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
$url = str_replace('%s', urlencode("$ns.$directive"), $this->docURL); $url = str_replace('%s', urlencode("$ns.$directive"), $this->docURL);
$ret .= $this->start('a', array('href' => $url)); $ret .= $this->start('a', array('href' => $url));
} }
$attr = array('for' => "{$this->name}:$ns.$directive"); $attr = array('for' => "{$this->name}:$ns.$directive");
// crop directive name if it's too long // crop directive name if it's too long
if (!$this->compress || (strlen($directive) < $this->compress)) { if (!$this->compress || (strlen($directive) < $this->compress)) {
$directive_disp = $directive; $directive_disp = $directive;
} else { } else {
$directive_disp = substr($directive, 0, $this->compress - 2) . '...'; $directive_disp = substr($directive, 0, $this->compress - 2) . '...';
$attr['title'] = $directive; $attr['title'] = $directive;
} }
$ret .= $this->element( $ret .= $this->element(
'label', 'label',
$directive_disp, $directive_disp,
// component printers must create an element with this id // component printers must create an element with this id
$attr $attr
); );
if ($this->docURL) $ret .= $this->end('a'); if ($this->docURL) {
$ret .= $this->end('a');
}
$ret .= $this->end('th'); $ret .= $this->end('th');
$ret .= $this->start('td'); $ret .= $this->start('td');
$def = $this->config->def->info["$ns.$directive"]; $def = $this->config->def->info["$ns.$directive"];
if (is_int($def)) { if (is_int($def)) {
$allow_null = $def < 0; $allow_null = $def < 0;
$type = abs($def); $type = abs($def);
} else { } else {
$type = $def->type; $type = $def->type;
$allow_null = isset($def->allow_null); $allow_null = isset($def->allow_null);
} }
if (!isset($this->fields[$type])) $type = 0; // default if (!isset($this->fields[$type])) {
$type_obj = $this->fields[$type]; $type = 0;
if ($allow_null) { } // default
$type_obj = new HTMLPurifier_Printer_ConfigForm_NullDecorator($type_obj); $type_obj = $this->fields[$type];
} if ($allow_null) {
$ret .= $type_obj->render($ns, $directive, $value, $this->name, array($this->genConfig, $this->config)); $type_obj = new HTMLPurifier_Printer_ConfigForm_NullDecorator($type_obj);
}
$ret .= $type_obj->render($ns, $directive, $value, $this->name, array($this->genConfig, $this->config));
$ret .= $this->end('td'); $ret .= $this->end('td');
$ret .= $this->end('tr'); $ret .= $this->end('tr');
} }
@@ -185,19 +207,33 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
/** /**
* Printer decorator for directives that accept null * Printer decorator for directives that accept null
*/ */
class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer { class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer
{
/** /**
* Printer being decorated * Printer being decorated
* @type HTMLPurifier_Printer
*/ */
protected $obj; protected $obj;
/** /**
* @param $obj Printer to decorate * @param HTMLPurifier_Printer $obj Printer to decorate
*/ */
public function __construct($obj) { public function __construct($obj)
{
parent::__construct(); parent::__construct();
$this->obj = $obj; $this->obj = $obj;
} }
public function render($ns, $directive, $value, $name, $config) {
/**
* @param string $ns
* @param string $directive
* @param string $value
* @param string $name
* @param HTMLPurifier_Config|array $config
* @return string
*/
public function render($ns, $directive, $value, $name, $config)
{
if (is_array($config) && isset($config[0])) { if (is_array($config) && isset($config[0])) {
$gen_config = $config[0]; $gen_config = $config[0];
$config = $config[1]; $config = $config[1];
@@ -215,15 +251,19 @@ class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'class' => 'null-toggle', 'class' => 'null-toggle',
'name' => "$name"."[Null_$ns.$directive]", 'name' => "$name" . "[Null_$ns.$directive]",
'id' => "$name:Null_$ns.$directive", 'id' => "$name:Null_$ns.$directive",
'onclick' => "toggleWriteability('$name:$ns.$directive',checked)" // INLINE JAVASCRIPT!!!! 'onclick' => "toggleWriteability('$name:$ns.$directive',checked)" // INLINE JAVASCRIPT!!!!
); );
if ($this->obj instanceof HTMLPurifier_Printer_ConfigForm_bool) { if ($this->obj instanceof HTMLPurifier_Printer_ConfigForm_bool) {
// modify inline javascript slightly // modify inline javascript slightly
$attr['onclick'] = "toggleWriteability('$name:Yes_$ns.$directive',checked);toggleWriteability('$name:No_$ns.$directive',checked)"; $attr['onclick'] =
"toggleWriteability('$name:Yes_$ns.$directive',checked);" .
"toggleWriteability('$name:No_$ns.$directive',checked)";
}
if ($value === null) {
$attr['checked'] = 'checked';
} }
if ($value === null) $attr['checked'] = 'checked';
$ret .= $this->elementEmpty('input', $attr); $ret .= $this->elementEmpty('input', $attr);
$ret .= $this->text(' or '); $ret .= $this->text(' or ');
$ret .= $this->elementEmpty('br'); $ret .= $this->elementEmpty('br');
@@ -235,10 +275,28 @@ class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer
/** /**
* Swiss-army knife configuration form field printer * Swiss-army knife configuration form field printer
*/ */
class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer { class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer
{
/**
* @type int
*/
public $cols = 18; public $cols = 18;
/**
* @type int
*/
public $rows = 5; public $rows = 5;
public function render($ns, $directive, $value, $name, $config) {
/**
* @param string $ns
* @param string $directive
* @param string $value
* @param string $name
* @param HTMLPurifier_Config|array $config
* @return string
*/
public function render($ns, $directive, $value, $name, $config)
{
if (is_array($config) && isset($config[0])) { if (is_array($config) && isset($config[0])) {
$gen_config = $config[0]; $gen_config = $config[0];
$config = $config[1]; $config = $config[1];
@@ -262,6 +320,7 @@ class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer {
foreach ($array as $val => $b) { foreach ($array as $val => $b) {
$value[] = $val; $value[] = $val;
} }
//TODO does this need a break?
case HTMLPurifier_VarParser::ALIST: case HTMLPurifier_VarParser::ALIST:
$value = implode(PHP_EOL, $value); $value = implode(PHP_EOL, $value);
break; break;
@@ -281,25 +340,27 @@ class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer {
$value = serialize($value); $value = serialize($value);
} }
$attr = array( $attr = array(
'name' => "$name"."[$ns.$directive]", 'name' => "$name" . "[$ns.$directive]",
'id' => "$name:$ns.$directive" 'id' => "$name:$ns.$directive"
); );
if ($value === null) $attr['disabled'] = 'disabled'; if ($value === null) {
$attr['disabled'] = 'disabled';
}
if (isset($def->allowed)) { if (isset($def->allowed)) {
$ret .= $this->start('select', $attr); $ret .= $this->start('select', $attr);
foreach ($def->allowed as $val => $b) { foreach ($def->allowed as $val => $b) {
$attr = array(); $attr = array();
if ($value == $val) $attr['selected'] = 'selected'; if ($value == $val) {
$attr['selected'] = 'selected';
}
$ret .= $this->element('option', $val, $attr); $ret .= $this->element('option', $val, $attr);
} }
$ret .= $this->end('select'); $ret .= $this->end('select');
} elseif ( } elseif ($type === HTMLPurifier_VarParser::TEXT ||
$type === HTMLPurifier_VarParser::TEXT || $type === HTMLPurifier_VarParser::ITEXT ||
$type === HTMLPurifier_VarParser::ITEXT || $type === HTMLPurifier_VarParser::ALIST ||
$type === HTMLPurifier_VarParser::ALIST || $type === HTMLPurifier_VarParser::HASH ||
$type === HTMLPurifier_VarParser::HASH || $type === HTMLPurifier_VarParser::LOOKUP) {
$type === HTMLPurifier_VarParser::LOOKUP
) {
$attr['cols'] = $this->cols; $attr['cols'] = $this->cols;
$attr['rows'] = $this->rows; $attr['rows'] = $this->rows;
$ret .= $this->start('textarea', $attr); $ret .= $this->start('textarea', $attr);
@@ -317,8 +378,18 @@ class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer {
/** /**
* Bool form field printer * Bool form field printer
*/ */
class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer { class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer
public function render($ns, $directive, $value, $name, $config) { {
/**
* @param string $ns
* @param string $directive
* @param string $value
* @param string $name
* @param HTMLPurifier_Config|array $config
* @return string
*/
public function render($ns, $directive, $value, $name, $config)
{
if (is_array($config) && isset($config[0])) { if (is_array($config) && isset($config[0])) {
$gen_config = $config[0]; $gen_config = $config[0];
$config = $config[1]; $config = $config[1];
@@ -336,12 +407,16 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
$attr = array( $attr = array(
'type' => 'radio', 'type' => 'radio',
'name' => "$name"."[$ns.$directive]", 'name' => "$name" . "[$ns.$directive]",
'id' => "$name:Yes_$ns.$directive", 'id' => "$name:Yes_$ns.$directive",
'value' => '1' 'value' => '1'
); );
if ($value === true) $attr['checked'] = 'checked'; if ($value === true) {
if ($value === null) $attr['disabled'] = 'disabled'; $attr['checked'] = 'checked';
}
if ($value === null) {
$attr['disabled'] = 'disabled';
}
$ret .= $this->elementEmpty('input', $attr); $ret .= $this->elementEmpty('input', $attr);
$ret .= $this->start('label', array('for' => "$name:No_$ns.$directive")); $ret .= $this->start('label', array('for' => "$name:No_$ns.$directive"));
@@ -351,12 +426,16 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
$attr = array( $attr = array(
'type' => 'radio', 'type' => 'radio',
'name' => "$name"."[$ns.$directive]", 'name' => "$name" . "[$ns.$directive]",
'id' => "$name:No_$ns.$directive", 'id' => "$name:No_$ns.$directive",
'value' => '0' 'value' => '0'
); );
if ($value === false) $attr['checked'] = 'checked'; if ($value === false) {
if ($value === null) $attr['disabled'] = 'disabled'; $attr['checked'] = 'checked';
}
if ($value === null) {
$attr['disabled'] = 'disabled';
}
$ret .= $this->elementEmpty('input', $attr); $ret .= $this->elementEmpty('input', $attr);
$ret .= $this->end('div'); $ret .= $this->end('div');
@@ -4,11 +4,16 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
{ {
/** /**
* Instance of HTMLPurifier_HTMLDefinition, for easy access * @type HTMLPurifier_HTMLDefinition, for easy access
*/ */
protected $def; protected $def;
public function render($config) { /**
* @param HTMLPurifier_Config $config
* @return string
*/
public function render($config)
{
$ret = ''; $ret = '';
$this->config =& $config; $this->config =& $config;
@@ -28,8 +33,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Renders the Doctype table * Renders the Doctype table
* @return string
*/ */
protected function renderDoctype() { protected function renderDoctype()
{
$doctype = $this->def->doctype; $doctype = $this->def->doctype;
$ret = ''; $ret = '';
$ret .= $this->start('table'); $ret .= $this->start('table');
@@ -45,8 +52,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Renders environment table, which is miscellaneous info * Renders environment table, which is miscellaneous info
* @return string
*/ */
protected function renderEnvironment() { protected function renderEnvironment()
{
$def = $this->def; $def = $this->def;
$ret = ''; $ret = '';
@@ -59,28 +68,28 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->row('Block wrap name', $def->info_block_wrapper); $ret .= $this->row('Block wrap name', $def->info_block_wrapper);
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Global attributes'); $ret .= $this->element('th', 'Global attributes');
$ret .= $this->element('td', $this->listifyAttr($def->info_global_attr),0,0); $ret .= $this->element('td', $this->listifyAttr($def->info_global_attr), null, 0);
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Tag transforms'); $ret .= $this->element('th', 'Tag transforms');
$list = array(); $list = array();
foreach ($def->info_tag_transform as $old => $new) { foreach ($def->info_tag_transform as $old => $new) {
$new = $this->getClass($new, 'TagTransform_'); $new = $this->getClass($new, 'TagTransform_');
$list[] = "<$old> with $new"; $list[] = "<$old> with $new";
} }
$ret .= $this->element('td', $this->listify($list)); $ret .= $this->element('td', $this->listify($list));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Pre-AttrTransform'); $ret .= $this->element('th', 'Pre-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre)); $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Post-AttrTransform'); $ret .= $this->element('th', 'Post-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post)); $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->end('table'); $ret .= $this->end('table');
@@ -89,8 +98,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Renders the Content Sets table * Renders the Content Sets table
* @return string
*/ */
protected function renderContentSets() { protected function renderContentSets()
{
$ret = ''; $ret = '';
$ret .= $this->start('table'); $ret .= $this->start('table');
$ret .= $this->element('caption', 'Content Sets'); $ret .= $this->element('caption', 'Content Sets');
@@ -106,8 +117,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Renders the Elements ($info) table * Renders the Elements ($info) table
* @return string
*/ */
protected function renderInfo() { protected function renderInfo()
{
$ret = ''; $ret = '';
$ret .= $this->start('table'); $ret .= $this->start('table');
$ret .= $this->element('caption', 'Elements ($info)'); $ret .= $this->element('caption', 'Elements ($info)');
@@ -118,39 +131,39 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->end('tr'); $ret .= $this->end('tr');
foreach ($this->def->info as $name => $def) { foreach ($this->def->info as $name => $def) {
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', "<$name>", array('class'=>'heavy', 'colspan' => 2)); $ret .= $this->element('th', "<$name>", array('class' => 'heavy', 'colspan' => 2));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Inline content'); $ret .= $this->element('th', 'Inline content');
$ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No'); $ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No');
$ret .= $this->end('tr'); $ret .= $this->end('tr');
if (!empty($def->excludes)) { if (!empty($def->excludes)) {
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Excludes'); $ret .= $this->element('th', 'Excludes');
$ret .= $this->element('td', $this->listifyTagLookup($def->excludes)); $ret .= $this->element('td', $this->listifyTagLookup($def->excludes));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
} }
if (!empty($def->attr_transform_pre)) { if (!empty($def->attr_transform_pre)) {
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Pre-AttrTransform'); $ret .= $this->element('th', 'Pre-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre)); $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
} }
if (!empty($def->attr_transform_post)) { if (!empty($def->attr_transform_post)) {
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Post-AttrTransform'); $ret .= $this->element('th', 'Post-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post)); $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
} }
if (!empty($def->auto_close)) { if (!empty($def->auto_close)) {
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Auto closed by'); $ret .= $this->element('th', 'Auto closed by');
$ret .= $this->element('td', $this->listifyTagLookup($def->auto_close)); $ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
} }
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', 'Allowed attributes'); $ret .= $this->element('th', 'Allowed attributes');
$ret .= $this->element('td',$this->listifyAttr($def->attr), array(), 0); $ret .= $this->element('td', $this->listifyAttr($def->attr), array(), 0);
$ret .= $this->end('tr'); $ret .= $this->end('tr');
if (!empty($def->required_attr)) { if (!empty($def->required_attr)) {
@@ -165,64 +178,94 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Renders a row describing the allowed children of an element * Renders a row describing the allowed children of an element
* @param $def HTMLPurifier_ChildDef of pertinent element * @param HTMLPurifier_ChildDef $def HTMLPurifier_ChildDef of pertinent element
* @return string
*/ */
protected function renderChildren($def) { protected function renderChildren($def)
{
$context = new HTMLPurifier_Context(); $context = new HTMLPurifier_Context();
$ret = ''; $ret = '';
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$elements = array();
$attr = array();
if (isset($def->elements)) {
if ($def->type == 'strictblockquote') {
$def->validateChildren(array(), $this->config, $context);
}
$elements = $def->elements;
}
if ($def->type == 'chameleon') {
$attr['rowspan'] = 2;
} elseif ($def->type == 'empty') {
$elements = array(); $elements = array();
$attr = array(); } elseif ($def->type == 'table') {
if (isset($def->elements)) { $elements = array_flip(
if ($def->type == 'strictblockquote') { array(
$def->validateChildren(array(), $this->config, $context); 'col',
} 'caption',
$elements = $def->elements; 'colgroup',
} 'thead',
if ($def->type == 'chameleon') { 'tfoot',
$attr['rowspan'] = 2; 'tbody',
} elseif ($def->type == 'empty') { 'tr'
$elements = array(); )
} elseif ($def->type == 'table') { );
$elements = array_flip(array('col', 'caption', 'colgroup', 'thead', }
'tfoot', 'tbody', 'tr')); $ret .= $this->element('th', 'Allowed children', $attr);
}
$ret .= $this->element('th', 'Allowed children', $attr);
if ($def->type == 'chameleon') { if ($def->type == 'chameleon') {
$ret .= $this->element('td', $ret .= $this->element(
'<em>Block</em>: ' . 'td',
$this->escape($this->listifyTagLookup($def->block->elements)),0,0); '<em>Block</em>: ' .
$ret .= $this->end('tr'); $this->escape($this->listifyTagLookup($def->block->elements)),
$ret .= $this->start('tr'); null,
$ret .= $this->element('td', 0
'<em>Inline</em>: ' . );
$this->escape($this->listifyTagLookup($def->inline->elements)),0,0); $ret .= $this->end('tr');
$ret .= $this->start('tr');
$ret .= $this->element(
'td',
'<em>Inline</em>: ' .
$this->escape($this->listifyTagLookup($def->inline->elements)),
null,
0
);
} elseif ($def->type == 'custom') { } elseif ($def->type == 'custom') {
$ret .= $this->element('td', '<em>'.ucfirst($def->type).'</em>: ' . $ret .= $this->element(
$def->dtd_regex); 'td',
'<em>' . ucfirst($def->type) . '</em>: ' .
$def->dtd_regex
);
} else { } else {
$ret .= $this->element('td', $ret .= $this->element(
'<em>'.ucfirst($def->type).'</em>: ' . 'td',
$this->escape($this->listifyTagLookup($elements)),0,0); '<em>' . ucfirst($def->type) . '</em>: ' .
} $this->escape($this->listifyTagLookup($elements)),
null,
0
);
}
$ret .= $this->end('tr'); $ret .= $this->end('tr');
return $ret; return $ret;
} }
/** /**
* Listifies a tag lookup table. * Listifies a tag lookup table.
* @param $array Tag lookup array in form of array('tagname' => true) * @param array $array Tag lookup array in form of array('tagname' => true)
* @return string
*/ */
protected function listifyTagLookup($array) { protected function listifyTagLookup($array)
{
ksort($array); ksort($array);
$list = array(); $list = array();
foreach ($array as $name => $discard) { foreach ($array as $name => $discard) {
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue; if ($name !== '#PCDATA' && !isset($this->def->info[$name])) {
continue;
}
$list[] = $name; $list[] = $name;
} }
return $this->listify($list); return $this->listify($list);
@@ -230,13 +273,15 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Listifies a list of objects by retrieving class names and internal state * Listifies a list of objects by retrieving class names and internal state
* @param $array List of objects * @param array $array List of objects
* @return string
* @todo Also add information about internal state * @todo Also add information about internal state
*/ */
protected function listifyObjectList($array) { protected function listifyObjectList($array)
{
ksort($array); ksort($array);
$list = array(); $list = array();
foreach ($array as $discard => $obj) { foreach ($array as $obj) {
$list[] = $this->getClass($obj, 'AttrTransform_'); $list[] = $this->getClass($obj, 'AttrTransform_');
} }
return $this->listify($list); return $this->listify($list);
@@ -244,13 +289,17 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Listifies a hash of attributes to AttrDef classes * Listifies a hash of attributes to AttrDef classes
* @param $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef) * @param array $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef)
* @return string
*/ */
protected function listifyAttr($array) { protected function listifyAttr($array)
{
ksort($array); ksort($array);
$list = array(); $list = array();
foreach ($array as $name => $obj) { foreach ($array as $name => $obj) {
if ($obj === false) continue; if ($obj === false) {
continue;
}
$list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>'; $list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
} }
return $this->listify($list); return $this->listify($list);
@@ -258,15 +307,18 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
/** /**
* Creates a heavy header row * Creates a heavy header row
* @param string $text
* @param int $num
* @return string
*/ */
protected function heavyHeader($text, $num = 1) { protected function heavyHeader($text, $num = 1)
{
$ret = ''; $ret = '';
$ret .= $this->start('tr'); $ret .= $this->start('tr');
$ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy')); $ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy'));
$ret .= $this->end('tr'); $ret .= $this->end('tr');
return $ret; return $ret;
} }
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 B

-48
View File
@@ -1,48 +0,0 @@
#sms5_send {position:relative}
.sms5_box {position:relative;padding:10px;border-radius:5px;background:#fbec99}
.sms5_box .box_ico {position:absolute;top:20px;left:-7px;width:7px;height:13px;background:url('img/box_ico.gif') no-repeat}
.sms5_box .box_txt {border:0;background:transparent;word-break:break-all;resize:none;overflow:hidden}
.sms5_box .box_square {width:100px;height:90px}
#send_write {padding:0 20px !important}
#send_write h2 {padding:0 0 10px}
#send_write .sms5_box {margin:0 0 5px;text-align:center}
#send_write .box_txt {width:90%;height:80px}
#wr_message_lbl {position:absolute;top:45px;left:48%;color:#999;font-size:0.95em;letter-spacing:-0.1em}
.write_inner {position:relative;padding:10px 0;border-bottom:1px solid #efefef;zoom:1}
.write_inner:after {display:block;visibility:hidden;clear:both;content:''}
.write_inner h2 {margin:0;padding:0 0 20px !important}
.write_floater {position:absolute;top:10px;right:0;text-align:right}
.write_floater_btn {margin:0;padding:0;border:0;background:transparent;color:#999;font-size:0.95em;letter-spacing:-0.1em}
#write_rcv {margin:0 0 10px}
#write_rcv strong {display:inline-block;margin:0 10px 0 0}
#write_reply label {display:inline-block;margin:0 10px 0 0;font-weight:bold}
#write_reply #mh_reply {padding:0 5px;width:90px;height:20px;border:1px solid #e9e9e9;text-align:center;line-height:1.8em}
#write_rsv .rsv_line {display:block;height:10px}
.write_scemo strong {display:block;margin:0 0 10px}
.write_scemo .scemo_btn {margin:0 0 1px;padding:10px 0;width:100%;border:0;background:#686868;color:#fff;text-align:center}
.write_scemo .scemo_list {display:none;letter-spacing:-4px}
.write_scemo .list_closer {margin:5px 0;text-align:right}
.write_scemo .list_closer_btn {margin:0;padding:10px 0;width:100%;border:0;background:#383838;color:#fff;letter-spacing:0}
.write_scemo .scemo_add {margin:0;padding:0;width:25%;height:40px;border:1px solid #e9e9e9;background:transparent;letter-spacing:0}
#write_sc .scemo_list {margin:0 0 20px}
#sms_byte {position:absolute;top:-27px;right:0;color:#999}
#send_emo {position:relative;padding:20px;border-top:1px solid #e9e9e9;background:#f7f7f7}
#send_emo h2 {margin:0 0 20px}
#send_emo .tmp_loading {display:block;padding:180px 0 0;text-align:center}
#send_emo #emo_sel {position:absolute;top:20px;right:20px;margin:0}
#send_emo .emo_list {margin:0;padding:0;list-style:none}
#send_emo li {float:left;margin:0 2% 10px 0;width:49%}
#send_emo li:nth-of-type(even) {margin:0 0 10px}
#send_emo .sms5_box {background:#fbec99}
#send_emo .box_ico {display:none}
#send_emo .box_txt {cursor:pointer}
#send_emo .emo_tit {display:block;height:20px;line-height:2em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#send_emo .btn_submit {padding:0 5px;height:24px;border:1px solid #ccc;background:#fafafa;color:#000;font-size:0.95em;vertical-align:middle;cursor:pointer}
-50
View File
@@ -1,50 +0,0 @@
#sms5_send {position:relative}
.sms5_box {position:relative;padding:10px;border-radius:5px;background:#fbec99}
.sms5_box .box_ico {position:absolute;top:20px;left:-7px;width:7px;height:13px;background:url('img/box_ico.gif') no-repeat}
.sms5_box .box_txt {border:0;background:transparent;word-break:break-all;resize:none;overflow:hidden}
.sms5_box .box_square {width:100px;height:90px}
#send_write {padding:0 20px !important}
#send_write h2 {padding:0 0 10px}
#send_write .sms5_box {margin:0 0 5px;text-align:center}
#send_write .box_txt {width:390px;height:80px}
#wr_message_lbl {position:absolute;top:45px;left:200px;color:#999;font-size:0.95em;letter-spacing:-0.1em}
.write_inner {position:relative;padding:10px 0;border-bottom:1px solid #efefef;zoom:1}
.write_inner:after {display:block;visibility:hidden;clear:both;content:''}
.write_inner h2 {margin:0;padding:0 0 10px !important}
.write_floater {position:absolute;top:15px;right:0;text-align:right}
.write_floater_btn {margin:0;padding:0;border:0;background:transparent;color:#999;font-size:0.95em;letter-spacing:-0.1em}
#write_rcv {float:left;height:22px;line-height:1.8em}
#write_rcv strong {display:inline-block;margin:0 10px 0 0}
#write_reply {float:right}
#write_reply label {display:inline-block;margin:0 10px 0 0;font-weight:bold}
#write_reply #mh_reply {padding:0 5px;width:90px;height:20px;border:1px solid #e9e9e9;text-align:center;line-height:1.8em}
.write_scemo {width:48%}
.write_scemo strong {display:block;margin:0 0 10px}
.write_scemo .scemo_list {letter-spacing:-4px}
.write_scemo .scemo_add {margin:0;padding:0;height:25px;border:1px solid #e9e9e9;background:transparent;letter-spacing:0}
#write_sc {float:left}
#write_sc .scemo_add {width:25px}
#write_emo {float:right}
#write_emo .scemo_list {text-align:right}
#write_emo .scemo_add {width:66px}
#write_emo .emo_long {}
#sms_byte {position:absolute;top:-27px;right:0;color:#999}
#send_emo {position:relative;padding:20px;border-top:1px solid #e9e9e9;background:#f7f7f7}
#send_emo h2 {margin:0 0 20px}
#send_emo .tmp_loading {display:block;padding:180px 0 0;text-align:center}
#send_emo #emo_sel {position:absolute;top:20px;right:20px;margin:0}
#send_emo .emo_list {margin:0;padding:0;list-style:none}
#send_emo li {float:left;margin:0 10px 10px 0 !important;margin:0 5px 10px 0;width:113px !important;width:110px}
#send_emo li:nth-of-type(3n) {margin:0 0 10px !important}
#send_emo .sms5_box {background:#fbec99}
#send_emo .box_ico {display:none}
#send_emo .box_txt {cursor:pointer}
#send_emo .emo_tit {display:block;height:20px;line-height:2em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#send_emo .btn_submit {padding:0 5px;height:24px;border:1px solid #ccc;background:#fafafa;color:#000;font-size:0.95em;vertical-align:middle;cursor:pointer}
-378
View File
@@ -1,378 +0,0 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$sms5_skin_url.'/style.css">', 0);
?>
<div id="sms5_send" class="new_win">
<h1 id="win_title">SMS 보내기</h1>
<div id="send_write">
<form action="<?php echo $action_url?>" onsubmit="return smssend_submit(this);" name="smsform" method="post" autocomplete="off">
<input type="hidden" name="token" value="<?php echo $token?>">
<input type="hidden" name="mh_hp" value="">
<input type="hidden" name="mb_id" value="<?php echo $mb_id?>">
<h2>보낼내용</h2>
<div class="sms5_box">
<span class="box_ico"></span>
<label for="mh_message" id="wr_message_lbl">내용</label>
<textarea name="mh_message" id="mh_message" class="box_txt" onkeyup="byte_check('mh_message', 'sms_bytes');"></textarea>
<div id="sms_byte"><span id="sms_bytes">0</span> / 80 byte</div>
</div>
<div class="write_inner">
<?php if( $mb['mb_id'] ){ //회원 아이디가 있다면 ?>
<div id="write_rcv">
<strong>수신회원</strong> <?php echo $mb['mb_nick']?>
</div>
<?php } ?>
<div id="write_reply">
<label for="mh_reply">회신번호</label>
<input type="text" name="mh_reply" value="<?php echo $member['mb_hp']?>" id="mh_reply" <?php if ($is_admin != 'super') { ?> readonly<?php } ?>>
</div>
</div>
<div id="write_rsv" class="write_inner">
<h2>예약전송</h2>
<div class="write_floater">
<label for="booking_flag"><span class="sound_only">예약전송 </span>사용</label>
<input type="checkbox" name="booking_flag" id="booking_flag" value="true" onclick="booking_show()" >
</div>
<select name="mh_by" id="mh_by" disabled>
<option value="<?php echo date('Y')?>"><?php echo date('Y')?></option>
<option value="<?php echo date('Y')+1?>"><?php echo date('Y')+1?></option>
</select> 년
<select name="mh_bm" id="mh_bm" disabled>
<?php for ($i=1; $i<=12; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('m')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 월
<select name="mh_bd" id="mh_bd" disabled>
<?php for ($i=1; $i<=31; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('d')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 일
<select name="mh_bh" id="mh_bh" disabled>
<?php for ($i=0; $i<24; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('H')+1==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 시
<select name="mh_bi" id="mh_bi" disabled>
<?php for ($i=0; $i<=59; $i+=5) { ?>
<option value="<?php echo sprintf("%02d",$i)?>"><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 분
</div>
<div class="write_inner">
<div id="write_sc" class="write_scemo">
<strong>특수기호</strong>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('■')">■</button>
<button type="button" class="scemo_add" onclick="javascript:add('□')">□</button>
<button type="button" class="scemo_add" onclick="javascript:add('▣')">▣</button>
<button type="button" class="scemo_add" onclick="javascript:add('◈')">◈</button>
<button type="button" class="scemo_add" onclick="javascript:add('◆')">◆</button>
<button type="button" class="scemo_add" onclick="javascript:add('◇')">◇</button>
<button type="button" class="scemo_add" onclick="javascript:add('♥')">♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡')">♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('●')">●</button>
<button type="button" class="scemo_add" onclick="javascript:add('○')">○</button>
<button type="button" class="scemo_add" onclick="javascript:add('▲')">▲</button>
<button type="button" class="scemo_add" onclick="javascript:add('▼')">▼</button>
<button type="button" class="scemo_add" onclick="javascript:add('▶')">▶</button>
<button type="button" class="scemo_add" onclick="javascript:add('▷')">▷</button>
<button type="button" class="scemo_add" onclick="javascript:add('◀')">◀</button>
<button type="button" class="scemo_add" onclick="javascript:add('◁')">◁</button>
<button type="button" class="scemo_add" onclick="javascript:add('☎')">☎</button>
<button type="button" class="scemo_add" onclick="javascript:add('☏')">☏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♠')">♠</button>
<button type="button" class="scemo_add" onclick="javascript:add('♤')">♤</button>
<button type="button" class="scemo_add" onclick="javascript:add('♣')">♣</button>
<button type="button" class="scemo_add" onclick="javascript:add('♧')">♧</button>
<button type="button" class="scemo_add" onclick="javascript:add('★')">★</button>
<button type="button" class="scemo_add" onclick="javascript:add('☆')">☆</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞')">☞</button>
<button type="button" class="scemo_add" onclick="javascript:add('☜')">☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('▒')">▒</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙')">⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('㈜')">㈜</button>
<button type="button" class="scemo_add" onclick="javascript:add('№')">№</button>
<button type="button" class="scemo_add" onclick="javascript:add('㉿')">㉿</button>
<button type="button" class="scemo_add" onclick="javascript:add('♨')">♨</button>
<button type="button" class="scemo_add" onclick="javascript:add('™')">™</button>
<button type="button" class="scemo_add" onclick="javascript:add('℡')">℡</button>
<button type="button" class="scemo_add" onclick="javascript:add('∑')">∑</button>
<button type="button" class="scemo_add" onclick="javascript:add('∏')">∏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♬')">♬</button>
<button type="button" class="scemo_add" onclick="javascript:add('♪')">♪</button>
<button type="button" class="scemo_add" onclick="javascript:add('♩')">♩</button>
<button type="button" class="scemo_add" onclick="javascript:add('♭')">♭</button>
</div>
</div>
<div id="write_emo" class="write_scemo">
<strong>이모티콘</strong>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('*^^*')">*^^*</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡.♡')">♡.♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('@_@')">@_@</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞_☜')">☞_☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('ㅠ ㅠ')">ㅠ ㅠ</button>
<button type="button" class="scemo_add" onclick="javascript:add('Θ.Θ')">Θ.Θ</button>
<button type="button" class="scemo_add" onclick="javascript:add('^_~♥')">^_~♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('~o~')">~o~</button>
<button type="button" class="scemo_add" onclick="javascript:add('★.★')">★.★</button>
<button type="button" class="scemo_add" onclick="javascript:add('(!.!)')">(!.!)</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙.⊙')">⊙.⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('q.p')">q.p</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('↖(^-^)↗')">↖(^-^)↗</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('(*^-^*)')">(*^-^*)</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('d(^-^)b')">d(^-^)b</button>
</div>
</div>
</div>
<div class="win_btn">
<input type="submit" value="전송" class="btn_submit">
<button type="button" onclick="window.close();">창닫기</button>
</div>
</form>
</div>
<?php if( count($emoticon_group) ){ //회원에게 공개된 이모티콘 그룹이 있다면 ?>
<div id="send_emo">
<h2>이모티콘 목록</h2>
<form name="emoticon_form">
<label for="emo_sel" class="sound_only">이모티콘 그룹</label>
<select name="fg_no" id="emo_sel">
<option value="" <?php echo $fg_no?'':'selected'?>>전체</option>
<?php for($i=0; $i<count($emoticon_group); $i++) {?>
<option value="<?php echo $emoticon_group[$i]['fg_no']?>"<?php echo ($fg_no==$emoticon_group[$i]['fg_no'])?'selected':''?>><?php echo $emoticon_group[$i]['fg_name']?> (<?php echo number_format($emoticon_group[$i]['fg_count'])?>)</option>
<?php } ?>
</select>
</form>
<ul class="emo_list">
</ul>
<nav class="pg_wrap">
<span class="pg" id="emoticon_pg"></span>
</nav>
<form name="emoticon_search" id="emoticon_search">
<input type="hidden" name="page" id="hidden_page" >
</form>
</div>
<?php } ?>
</div>
<script>
function sms_error(obj, err) {
alert(err);
obj.value = '';
}
function smssend_submit(f)
{
if (!f.mh_message.value)
{
alert('보내실 문자를 입력하십시오.');
f.mh_message.focus();
return false;
}
if (!f.mh_reply.value)
{
alert('발신 번호를 입력하십시오.\n\n발신 번호는 회원정보의 휴대폰번호입니다.');
return false;
}
return true;
//f.submit();
//win.focus();
}
function booking_show()
{
if (document.getElementById('booking_flag').checked) {
document.getElementById('mh_by').disabled = false;
document.getElementById('mh_bm').disabled = false;
document.getElementById('mh_bd').disabled = false;
document.getElementById('mh_bh').disabled = false;
document.getElementById('mh_bi').disabled = false;
} else {
document.getElementById('mh_by').disabled = true;
document.getElementById('mh_bm').disabled = true;
document.getElementById('mh_bd').disabled = true;
document.getElementById('mh_bh').disabled = true;
document.getElementById('mh_bi').disabled = true;
}
}
function add(str) {
var conts = document.getElementById('mh_message');
var bytes = document.getElementById('sms_bytes');
conts.focus();
conts.value+=str;
byte_check('mh_message', 'sms_bytes');
return;
}
function byte_check(mh_message, sms_bytes)
{
var conts = document.getElementById(mh_message);
var bytes = document.getElementById(sms_bytes);
var i = 0;
var cnt = 0;
var exceed = 0;
var ch = '';
for (i=0; i<conts.value.length; i++)
{
ch = conts.value.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
bytes.innerHTML = cnt;
if (cnt > 80)
{
exceed = cnt - 80;
alert('메시지 내용은 80바이트를 넘을수 없습니다.\n\n작성하신 메세지 내용은 '+ exceed +'byte가 초과되었습니다.\n\n초과된 부분은 자동으로 삭제됩니다.');
var tcnt = 0;
var xcnt = 0;
var tmp = conts.value;
for (i=0; i<tmp.length; i++)
{
ch = tmp.charAt(i);
if (escape(ch).length > 4) {
tcnt += 2;
} else {
tcnt += 1;
}
if (tcnt > 80) {
tmp = tmp.substring(0,i);
break;
} else {
xcnt = tcnt;
}
}
conts.value = tmp;
bytes.innerHTML = xcnt;
return;
}
}
byte_check('mh_message', 'sms_bytes');
</script>
<script src="<?php echo G5_JS_URL?>/jquery.sms_paging.js"></script>
<script>
var emoticon_list = {
go : function(fo_no){
var wr_message = document.getElementById('mh_message');
//wr_message.focus();
wr_message.value = document.getElementById('fo_contents_' + fo_no).value;
byte_check('mh_message', 'sms_bytes');
}
};
(function($){
$(".box_txt").bind("focus keydown", function(){
$("#wr_message_lbl").hide();
});
var $search_form = $("form#emoticon_search");
emoticon_list.fn_paging = function( hash_val,total_page ){
$('#emoticon_pg').paging({
current:hash_val ? hash_val : 1,
max:total_page == 0 || total_page ? total_page : 45,
length : 5,
liitem : 'span',
format:'{0}',
next:'next',
prev:'prev',
first:'&lt;&lt;',last:'&gt;&gt;',
href:'#',
itemCurrent:'pg_current',
itemClass:'pg_page',
appendhtml:'<span class="sound_only">페이지</span>',
onclick:function(e,page){
e.preventDefault();
$("#hidden_page").val( page );
var params = $($search_form).serialize();
emoticon_list.select_page( params, "json" );
}
});
}
emoticon_list.loading = function( el, src ){
if( !el || !src) return;
$(el).append("<span class='tmp_loading'><img src='"+src+"' title='loading...' ></span>");
}
emoticon_list.loadingEnd = function( el ){
$(".tmp_loading", $(el)).remove();
}
emoticon_list.select_page = function( params, type ){
if( !type ){
type = "json";
}
emoticon_list.loading(".emo_list", "<?php echo $sms5_skin_url?>/img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_emoticon.php",
cache:false,
timeout : 30000,
dataType:type,
data:params,
success: function(HttpRequest) {
if( type == "json" ){
if (HttpRequest.error) {
alert(HttpRequest.error);
return false;
} else {
var $emoticon_box = $(".emo_list");
var list_text = "";
$.each( HttpRequest.list_text , function(num) {
var list_data = HttpRequest.list_text[num];
list_text = list_text + "<li class=\"screen_list sms5_box\"><span class=\"box_ico\"></span><textarea class=\"sms_textarea box_txt box_square\" readonly onclick=\"emoticon_list.go("+list_data.fo_no+")\">"+list_data.fo_content+"</textarea><textarea id=\"fo_contents_"+list_data.fo_no+"\" style=\"display:none; width:0; height:0\">"+list_data.fo_content+"</textarea><strong class=\"emo_tit\">"+list_data.fo_name+"</strong></li>";
});
if( !list_text ){
list_text = "<li>데이터가 없습니다.</li>";
}
$emoticon_box.html( list_text );
emoticon_list.fn_paging( HttpRequest.page, HttpRequest.total_page );
$("#hidden_page").val( HttpRequest.page );
}
}
emoticon_list.loadingEnd(".emo_list"); //로딩 이미지 지움
}
});
}
$("#emo_sel").bind("change", function(e){
var params = { fg_no : $(this).val() };
$search_form[0].reset();
$("#hidden_fg_no").val( $(this).val() );
emoticon_list.select_page( params, "json" );
});
$search_form.submit(function(e){
e.preventDefault();
var $form = $(this),
params = $(this).serialize();
emoticon_list.select_page( params, "json" );
});
if( $("#emo_sel").length ){
$("#emo_sel").trigger("change");
}
})(jQuery);
</script>
@@ -1,394 +0,0 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$sms5_skin_url.'/mobile.css">', 0);
?>
<div id="sms5_send" class="new_win">
<h1 id="win_title">SMS 보내기</h1>
<div id="send_write">
<form action="<?php echo $action_url?>" onsubmit="return smssend_submit(this);" name="smsform" method="post" autocomplete="off">
<input type="hidden" name="token" value="<?php echo $token?>">
<input type="hidden" name="mh_hp" value="">
<input type="hidden" name="mb_id" value="<?php echo $mb_id?>">
<h2>보낼내용</h2>
<div class="sms5_box">
<span class="box_ico"></span>
<label for="mh_message" id="wr_message_lbl">내용</label>
<textarea name="mh_message" id="mh_message" class="box_txt" onkeyup="byte_check('mh_message', 'sms_bytes');"></textarea>
<div id="sms_byte"><span id="sms_bytes">0</span> / 80 byte</div>
</div>
<div class="write_inner">
<?php if( $mb['mb_id'] ){ //회원 아이디가 있다면 ?>
<div id="write_rcv">
<strong>수신회원</strong> <?php echo $mb['mb_nick']?>
</div>
<?php } ?>
<div id="write_reply">
<label for="mh_reply">회신번호</label>
<input type="text" name="mh_reply" value="<?php echo $member['mb_hp']?>" id="mh_reply" <?php if ($is_admin != 'super') { ?> readonly<?php } ?>>
</div>
</div>
<div id="write_rsv" class="write_inner">
<h2>예약전송</h2>
<div class="write_floater">
<label for="booking_flag"><span class="sound_only">예약전송 </span>사용</label>
<input type="checkbox" name="booking_flag" id="booking_flag" value="true" onclick="booking_show()" >
</div>
<select name="mh_by" id="mh_by" disabled>
<option value="<?php echo date('Y')?>"><?php echo date('Y')?></option>
<option value="<?php echo date('Y')+1?>"><?php echo date('Y')+1?></option>
</select> 년
<select name="mh_bm" id="mh_bm" disabled>
<?php for ($i=1; $i<=12; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('m')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 월
<span class="rsv_line"></span>
<select name="mh_bd" id="mh_bd" disabled>
<?php for ($i=1; $i<=31; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('d')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 일
<select name="mh_bh" id="mh_bh" disabled>
<?php for ($i=0; $i<24; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('H')+1==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 시
<select name="mh_bi" id="mh_bi" disabled>
<?php for ($i=0; $i<=59; $i+=5) { ?>
<option value="<?php echo sprintf("%02d",$i)?>"><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 분
</div>
<div class="write_inner">
<div id="write_sc" class="write_scemo">
<button type="button" id="scemo_sc" class="scemo_btn">특수기호</button>
<div class="scemo_list scemo_sc">
<div class="list_closer"><button type="button" class="list_closer_btn">특수기호닫기</button></div>
<button type="button" class="scemo_add" onclick="javascript:add('■')">■</button>
<button type="button" class="scemo_add" onclick="javascript:add('□')">□</button>
<button type="button" class="scemo_add" onclick="javascript:add('▣')">▣</button>
<button type="button" class="scemo_add" onclick="javascript:add('◈')">◈</button>
<button type="button" class="scemo_add" onclick="javascript:add('◆')">◆</button>
<button type="button" class="scemo_add" onclick="javascript:add('◇')">◇</button>
<button type="button" class="scemo_add" onclick="javascript:add('♥')">♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡')">♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('●')">●</button>
<button type="button" class="scemo_add" onclick="javascript:add('○')">○</button>
<button type="button" class="scemo_add" onclick="javascript:add('▲')">▲</button>
<button type="button" class="scemo_add" onclick="javascript:add('▼')">▼</button>
<button type="button" class="scemo_add" onclick="javascript:add('▶')">▶</button>
<button type="button" class="scemo_add" onclick="javascript:add('▷')">▷</button>
<button type="button" class="scemo_add" onclick="javascript:add('◀')">◀</button>
<button type="button" class="scemo_add" onclick="javascript:add('◁')">◁</button>
<button type="button" class="scemo_add" onclick="javascript:add('☎')">☎</button>
<button type="button" class="scemo_add" onclick="javascript:add('☏')">☏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♠')">♠</button>
<button type="button" class="scemo_add" onclick="javascript:add('♤')">♤</button>
<button type="button" class="scemo_add" onclick="javascript:add('♣')">♣</button>
<button type="button" class="scemo_add" onclick="javascript:add('♧')">♧</button>
<button type="button" class="scemo_add" onclick="javascript:add('★')">★</button>
<button type="button" class="scemo_add" onclick="javascript:add('☆')">☆</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞')">☞</button>
<button type="button" class="scemo_add" onclick="javascript:add('☜')">☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('▒')">▒</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙')">⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('㈜')">㈜</button>
<button type="button" class="scemo_add" onclick="javascript:add('№')">№</button>
<button type="button" class="scemo_add" onclick="javascript:add('㉿')">㉿</button>
<button type="button" class="scemo_add" onclick="javascript:add('♨')">♨</button>
<button type="button" class="scemo_add" onclick="javascript:add('™')">™</button>
<button type="button" class="scemo_add" onclick="javascript:add('℡')">℡</button>
<button type="button" class="scemo_add" onclick="javascript:add('∑')">∑</button>
<button type="button" class="scemo_add" onclick="javascript:add('∏')">∏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♬')">♬</button>
<button type="button" class="scemo_add" onclick="javascript:add('♪')">♪</button>
<button type="button" class="scemo_add" onclick="javascript:add('♩')">♩</button>
<button type="button" class="scemo_add" onclick="javascript:add('♭')">♭</button>
<div class="list_closer"><button type="button" class="list_closer_btn">특수기호닫기</button></div>
</div>
</div>
<div id="write_emo" class="write_scemo">
<button type="button" id="scemo_emo" class="scemo_btn">이모티콘</button>
<div class="scemo_list scemo_emo">
<div class="list_closer"><button type="button" class="list_closer_btn">이모티콘닫기</button></div>
<button type="button" class="scemo_add" onclick="javascript:add('*^^*')">*^^*</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡.♡')">♡.♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('@_@')">@_@</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞_☜')">☞_☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('ㅠ ㅠ')">ㅠ ㅠ</button>
<button type="button" class="scemo_add" onclick="javascript:add('Θ.Θ')">Θ.Θ</button>
<button type="button" class="scemo_add" onclick="javascript:add('^_~♥')">^_~♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('~o~')">~o~</button>
<button type="button" class="scemo_add" onclick="javascript:add('★.★')">★.★</button>
<button type="button" class="scemo_add" onclick="javascript:add('(!.!)')">(!.!)</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙.⊙')">⊙.⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('q.p')">q.p</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('↖(^-^)↗')">↖(^-^)↗</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('(*^-^*)')">(*^-^*)</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('d(^-^)b')">d(^-^)b</button>
<div class="list_closer"><button type="button" class="list_closer_btn">이모티콘닫기</button></div>
</div>
</div>
</div>
<div class="win_btn">
<input type="submit" value="전송" class="btn_submit">
<button type="button" onclick="window.close();">창닫기</button>
</div>
</form>
</div>
<?php if( count($emoticon_group) ){ //회원에게 공개된 이모티콘 그룹이 있다면 ?>
<div id="send_emo">
<h2>이모티콘 목록</h2>
<form name="emoticon_form">
<label for="emo_sel" class="sound_only">이모티콘 그룹</label>
<select name="fg_no" id="emo_sel">
<option value="" <?php echo $fg_no?'':'selected'?>>전체</option>
<?php for($i=0; $i<count($emoticon_group); $i++) {?>
<option value="<?php echo $emoticon_group[$i]['fg_no']?>"<?php echo ($fg_no==$emoticon_group[$i]['fg_no'])?'selected':''?>><?php echo $emoticon_group[$i]['fg_name']?> (<?php echo number_format($emoticon_group[$i]['fg_count'])?>)</option>
<?php } ?>
</select>
</form>
<ul class="emo_list">
</ul>
<nav class="pg_wrap">
<span class="pg" id="emoticon_pg"></span>
</nav>
<form name="emoticon_search" id="emoticon_search">
<input type="hidden" name="page" id="hidden_page" >
</form>
</div>
<?php } ?>
</div>
<script>
function sms_error(obj, err) {
alert(err);
obj.value = '';
}
function smssend_submit(f)
{
if (!f.mh_message.value)
{
alert('보내실 문자를 입력하십시오.');
f.mh_message.focus();
return false;
}
if (!f.mh_reply.value)
{
alert('발신 번호를 입력하십시오.\n\n발신 번호는 회원정보의 휴대폰번호입니다.');
return false;
}
return true;
//f.submit();
//win.focus();
}
function booking_show()
{
if (document.getElementById('booking_flag').checked) {
document.getElementById('mh_by').disabled = false;
document.getElementById('mh_bm').disabled = false;
document.getElementById('mh_bd').disabled = false;
document.getElementById('mh_bh').disabled = false;
document.getElementById('mh_bi').disabled = false;
} else {
document.getElementById('mh_by').disabled = true;
document.getElementById('mh_bm').disabled = true;
document.getElementById('mh_bd').disabled = true;
document.getElementById('mh_bh').disabled = true;
document.getElementById('mh_bi').disabled = true;
}
}
function add(str) {
var conts = document.getElementById('mh_message');
var bytes = document.getElementById('sms_bytes');
conts.focus();
conts.value+=str;
byte_check('mh_message', 'sms_bytes');
return;
}
function byte_check(mh_message, sms_bytes)
{
var conts = document.getElementById(mh_message);
var bytes = document.getElementById(sms_bytes);
var i = 0;
var cnt = 0;
var exceed = 0;
var ch = '';
for (i=0; i<conts.value.length; i++)
{
ch = conts.value.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
bytes.innerHTML = cnt;
if (cnt > 80)
{
exceed = cnt - 80;
alert('메시지 내용은 80바이트를 넘을수 없습니다.\n\n작성하신 메세지 내용은 '+ exceed +'byte가 초과되었습니다.\n\n초과된 부분은 자동으로 삭제됩니다.');
var tcnt = 0;
var xcnt = 0;
var tmp = conts.value;
for (i=0; i<tmp.length; i++)
{
ch = tmp.charAt(i);
if (escape(ch).length > 4) {
tcnt += 2;
} else {
tcnt += 1;
}
if (tcnt > 80) {
tmp = tmp.substring(0,i);
break;
} else {
xcnt = tcnt;
}
}
conts.value = tmp;
bytes.innerHTML = xcnt;
return;
}
}
byte_check('mh_message', 'sms_bytes');
</script>
<script src="<?php echo G5_JS_URL?>/jquery.sms_paging.js"></script>
<script>
var emoticon_list = {
go : function(fo_no){
var wr_message = document.getElementById('mh_message');
//wr_message.focus();
wr_message.value = document.getElementById('fo_contents_' + fo_no).value;
byte_check('mh_message', 'sms_bytes');
}
};
(function($){
$(".box_txt").bind("focus keydown", function(){
$("#wr_message_lbl").hide();
});
var $search_form = $("form#emoticon_search");
emoticon_list.fn_paging = function( hash_val,total_page ){
$('#emoticon_pg').paging({
current:hash_val ? hash_val : 1,
max:total_page == 0 || total_page ? total_page : 45,
length : 5,
liitem : 'span',
format:'{0}',
next:'next',
prev:'prev',
first:'&lt;&lt;',last:'&gt;&gt;',
href:'#',
itemCurrent:'pg_current',
itemClass:'pg_page',
appendhtml:'<span class="sound_only">페이지</span>',
onclick:function(e,page){
e.preventDefault();
$("#hidden_page").val( page );
var params = $($search_form).serialize();
emoticon_list.select_page( params, "json" );
}
});
}
emoticon_list.loading = function( el, src ){
if( !el || !src) return;
$(el).append("<span class='tmp_loading'><img src='"+src+"' title='loading...' ></span>");
}
emoticon_list.loadingEnd = function( el ){
$(".tmp_loading", $(el)).remove();
}
emoticon_list.select_page = function( params, type ){
if( !type ){
type = "json";
}
emoticon_list.loading(".emo_list", "<?php echo $sms5_skin_url?>/img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_emoticon.php",
cache:false,
timeout : 30000,
dataType:type,
data:params,
success: function(HttpRequest) {
if( type == "json" ){
if (HttpRequest.error) {
alert(HttpRequest.error);
return false;
} else {
var $emoticon_box = $(".emo_list");
var list_text = "";
$.each( HttpRequest.list_text , function(num) {
var list_data = HttpRequest.list_text[num];
list_text = list_text + "<li class=\"screen_list\"><div class=\"sms5_box\"><span class=\"box_ico\"></span><textarea class=\"sms_textarea box_txt box_square\" readonly onclick=\"emoticon_list.go("+list_data.fo_no+")\">"+list_data.fo_content+"</textarea><textarea id=\"fo_contents_"+list_data.fo_no+"\" style=\"display:none; width:0; height:0\">"+list_data.fo_content+"</textarea><strong class=\"emo_tit\">"+list_data.fo_name+"</strong></div></li>";
});
if( !list_text ){
list_text = "<li>데이터가 없습니다.</li>";
}
$emoticon_box.html( list_text );
emoticon_list.fn_paging( HttpRequest.page, HttpRequest.total_page );
$("#hidden_page").val( HttpRequest.page );
}
}
emoticon_list.loadingEnd(".emo_list"); //로딩 이미지 지움
}
});
}
$("#emo_sel").bind("change", function(e){
var params = { fg_no : $(this).val() };
$search_form[0].reset();
$("#hidden_fg_no").val( $(this).val() );
emoticon_list.select_page( params, "json" );
});
$search_form.submit(function(e){
e.preventDefault();
var $form = $(this),
params = $(this).serialize();
emoticon_list.select_page( params, "json" );
});
if( $("#emo_sel").length ){
$("#emo_sel").trigger("change");
}
$(".scemo_btn").click(function(){
var scemoid = $(this).attr("id");
$(this).hide();
$(".scemo_list").hide();
$("."+scemoid).show();
});
$(".list_closer_btn").click(function(){
$(".scemo_btn").show();
$(".scemo_list").hide();
});
})(jQuery);
</script>
-13
View File
@@ -7,19 +7,6 @@ if (!defined('_GNUBOARD_')) exit;
** **
*************************************************************************/ *************************************************************************/
// 스킨디렉토리를 SELECT 형식으로 얻음
function get_sms5_skin_select($skin_gubun, $id, $name, $selected='', $event='')
{
$skins = get_skin_dir($skin_gubun, G5_SMS5_PATH);
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
for ($i=0; $i<count($skins); $i++) {
if ($i == 0) $str .= "<option value=\"\">선택</option>";
$str .= option_selected($skins[$i], $selected);
}
$str .= "</select>";
return $str;
}
// 한페이지에 보여줄 행, 현재페이지, 총페이지수, URL // 한페이지에 보여줄 행, 현재페이지, 총페이지수, URL
function sms5_sub_paging($write_pages, $cur_page, $total_page, $url, $add="", $starget="") function sms5_sub_paging($write_pages, $cur_page, $total_page, $url, $add="", $starget="")
{ {
-75
View File
@@ -1,75 +0,0 @@
<?php
if (!defined('_GNUBOARD_')) exit;
if(!$config['cf_sms_use'])
alert_close('문자보내기를 이용하실 수 없습니다.');
if( !$sms5['bo_skin'] ){
$sms5['bo_skin'] = "basic";
}
$err = null;
if (!$mb_id){
$err = "받는회원 아이디가 넘어오지 않았습니다.";
alert_close($err);
}
if (!$sms5['cf_member']){
$err = "문자전송이 허용되지 않았습니다.\\n\\n사이트 관리자에게 문의하여 주십시오.";
alert_close($err);
}
if (!$err and !$is_member){
$err = "로그인 해주세요.";
alert_close($err);
}
if (!$err and $member['mb_level'] < $sms5['cf_level']){
$err = "회원 {$sms5['cf_level']} 레벨 이상만 문자전송이 가능합니다.";
alert_close($err);
}
// 오늘 문자를 보낸 총 건수
$row = sql_fetch(" select count(*) as cnt from {$g5['sms5_member_history_table']} where mb_id='{$member['mb_id']}' and date_format(mh_datetime, '%Y-%m-%d') = '".G5_TIME_YMD."' ");
$total = $row['cnt'];
// 건수 제한
if (!$err and $sms5['cf_day_count'] > 0 && $is_admin != 'super') {
if ($total >= $sms5['cf_day_count']) {
$err = "하루에 보낼수 있는 문자갯수(".number_format($sms5['cf_day_count'])." 건)를 초과하였습니다.";
alert_close($err);
}
}
// 포인트 검사
if (!$err and $sms5['cf_point'] > 0 && $is_admin != 'super') {
if ($sms5['cf_point'] > $member['mb_point']) {
$err = "보유하신 포인트(".number_format($member['mb_point'])." 포인트)가 없거나 모자라서\\n\\n문자전송(".number_format($sms5['cf_point'])." 포인트)이 불가합니다.\\n\\n포인트를 적립하신 후 다시 시도 해 주십시오.";
alert_close($err);
}
}
// 특정회원에게 문자 전송
if ($mb_id) {
$mb = get_member($mb_id);
if (!$mb['mb_hp']) alert_close("회원 휴대폰번호가 없습니다.");
if (!$mb['mb_open']) alert_close("정보를 공개하지 않았습니다.");
if (!$mb['mb_sms']) alert_close("SMS 수신여부가 비활성화 되어 있습니다.");
//$hp = $mb['mb_hp'];
}
$g5['title'] = "문자전송";
$token = get_token();
$emoticon_group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} where fg_member = 1 order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($emoticon_group, $res);
$action_url = "./write_update.php";
if( G5_IS_MOBILE ){
$write_skin_page = "/write_mobile.skin.php";
} else {
$write_skin_page = "/write.skin.php";
}
include_once ($sms5_skin_path.$write_skin_page);
echo PHP_EOL.'<!-- skin : '.$sms5['bo_skin'].' -->'.PHP_EOL;
?>
-170
View File
@@ -1,170 +0,0 @@
<?php
include_once("./_common.php");
if(!$config['cf_sms_use'])
alert_close('문자보내기를 이용하실 수 없습니다.');
// SMS 라이브러리
$config['cf_sms_type'] = '';
include_once(G5_LIB_PATH.'/icode.sms.lib.php');
include_once(G5_SMS5_PATH.'/sms5.lib.php');
$g5['title'] = "문자전송중";
if (!($token && get_session("ss_token") == $token))
die("올바른 방법으로 사용해 주십시오.");
if (!$sms5['cf_member'])
die("문자전송이 허용되지 않았습니다. 사이트 관리자에게 문의하여 주십시오.");
if (!$is_member)
die("로그인 해주세요.");
if ($member['mb_level'] < $sms5['cf_level'])
alert("회원 {$sms5['cf_level']}레벨 이상만 문자전송이 가능합니다.");
$mh_reply = preg_replace('#[^0-9\-]#', '', trim($mh_reply));
$mh_message = clean_xss_tags(trim($mh_message));
if (!$mh_reply)
alert('보내는 번호를 입력해주세요.');
if (!$mh_message)
alert('메세지를 입력해주세요.');
if ($is_admin != 'super')
{
$mh_reply = get_hp($mh_reply, 0);
if (!$mh_reply)
alert("보내는 번호가 올바르지 않습니다.");
}
else
{
$mh_reply = str_replace("-", "", $mh_reply);;
if (!check_string($mh_reply, G5_NUMERIC))
alert("보내는 번호가 올바르지 않습니다.");
}
$mh_hp = explode(',', $mh_hp);
if ($mb_id) {
$mb = get_member($mb_id);
if (!$mb['mb_sms'] || !$mb['mb_open']) {
alert("정보를 공개하지 않았습니다.");
}
if( $mb['mb_hp'] ){
array_push( $mh_hp, $mb['mb_hp'] );
}
}
if (!count($mh_hp))
alert('받는 번호를 입력해주세요.');
// 핸드폰 번호만 걸러낸다.
$tmp = array();
for ($i=0; $i<count($mh_hp); $i++)
{
$hp = trim($mh_hp[$i]);
$hp = get_hp($hp);
if ($hp)
$tmp[]['bk_hp'] = get_hp($hp, 0);
}
$mh_hp = $tmp;
$total = count($mh_hp);
// 건수 제한
if ($sms5['cf_day_count'] > 0 && $is_admin != 'super') {
$row = sql_fetch(" select count(*) as cnt from {$g5['sms5_member_history_table']} where mb_id='{$member['mb_id']}' and date_format(mh_datetime, '%Y-%m-%d') = '".G5_TIME_YMD."' ");
if ($row['cnt'] + $total > $sms5['cf_day_count']) {
alert("하루에 보낼수 있는 문자갯수(".number_format($sms5['cf_day_count']).")를 초과하였습니다.");
}
}
// 포인트 검사
if ($sms5['cf_point'] > 0 && $is_admin != 'super') {
$minus_point = $sms5['cf_point'] * $total;
if ($minus_point > $member['mb_point'])
alert("보유하신 포인트(".number_format($member['mb_point']).")가 없거나 모자라서 문자전송(".number_format($minus_point).")이 불가합니다.\\n\\n포인트를 적립하신 후 다시 시도 해 주십시오.");
} else
$minus_point = 0;
// 예약전송
if ($mh_by && $mh_bm && $mh_bd && $mh_bh && $mh_bi) {
$mh_booking = "$mh_by-$mh_bm-$mh_bd $mh_bh:$mh_bi:00";
$booking = $mh_by.$mh_bm.$mh_bd.$mh_bh.$mh_bi;
} else {
$mh_booking = '';
$booking = '';
}
$SMS = new SMS5;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$mh_message = conv_unescape_nl($mh_message);
$result = $SMS->Add($mh_hp, $mh_reply, '', '', $mh_message, $booking, $total);
$is_success = null;
if ($result)
{
$result = $SMS->Send();
if ($result) //SMS 서버에 접속했습니다.
{
foreach ($SMS->Result as $result)
{
list($hp, $code) = explode(":", $result);
if (substr($code,0,5) == "Error")
{
$is_success = false;
switch (substr($code,6,2)) {
case '02': // "02:형식오류"
$mh_log = "형식이 잘못되어 전송이 실패하였습니다.";
break;
case '23': // "23:인증실패,데이터오류,전송날짜오류"
$mh_log = "데이터를 다시 확인해 주시기바랍니다.";
break;
case '97': // "97:잔여코인부족"
$mh_log = "잔여코인이 부족합니다.";
break;
case '98': // "98:사용기간만료"
$mh_log = "사용기간이 만료되었습니다.";
break;
case '99': // "99:인증실패"
$mh_log = "인증 받지 못하였습니다. 계정을 다시 확인해 주세요.";
break;
default: // "미 확인 오류"
$mh_log = "알 수 없는 오류로 전송이 실패하었습니다.";
break;
}
}
else
{
$is_success = true;
$mh_log = "문자전송:".get_hp($hp, 1);
}
$hp = get_hp($hp, 1);
$log = array_shift($SMS->Log);
sql_query("insert into {$g5['sms5_member_history_table']} set mb_id='{$member['mb_id']}', mh_reply='$mh_reply', mh_hp='$hp', mh_datetime='".G5_TIME_YMDHIS."', mh_booking='$mh_booking', mh_log='$mh_log', mh_ip='".$_SERVER['REMOTE_ADDR']."'");
if ($is_admin == 'super')
$sms5['cf_point'] = 0;
if ($is_success)
insert_point($member['mb_id'], (-1) * $sms5['cf_point'], "$mh_log");
}
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
else alert("에러: SMS 서버와 통신이 불안정합니다.");
}
else alert("에러: SMS 데이터 입력도중 에러가 발생하였습니다.");
alert_close("$total 건의 문자메세지 전송을 완료하였습니다.");
?>
+1 -1
View File
@@ -36,6 +36,6 @@ $gplus_url = $sns_send.'&amp;sns=gplus';
<li><a href="<?php echo $twitter_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter.png" alt="트위터로 보내기"></a></li> <li><a href="<?php echo $twitter_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter.png" alt="트위터로 보내기"></a></li>
<li><a href="<?php echo $gplus_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/gplus.png" alt="구글플러스로 보내기"></a></li> <li><a href="<?php echo $gplus_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/gplus.png" alt="구글플러스로 보내기"></a></li>
<?php if(G5_IS_MOBILE && $config['cf_kakao_js_apikey']) { ?> <?php if(G5_IS_MOBILE && $config['cf_kakao_js_apikey']) { ?>
<li><a href="javascript:kakaolink_send('<?php echo $sns_msg; ?>', '<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>');"><img src="<?php echo G5_SNS_URL; ?>/icon/kakaotalk.png" alt="카카오톡으로 보내기"></a> <li><a href="javascript:kakaolink_send('<?php echo $sns_msg; ?>', '<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>');"><img src="<?php echo G5_SNS_URL; ?>/icon/kakaotalk.png" alt="카카오톡으로 보내기"></a></li>
<?php } ?> <?php } ?>
</ul> </ul>
+24 -1
View File
@@ -22,7 +22,30 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
<section id="fregister_private"> <section id="fregister_private">
<h2>개인정보처리방침안내</h2> <h2>개인정보처리방침안내</h2>
<textarea readonly><?php echo get_text($config['cf_privacy']) ?></textarea> <div class="tbl_head01 tbl_wrap">
<table>
<caption>개인정보처리방침안내</caption>
<thead>
<tr>
<th>목적</th>
<th>항목</th>
<th>보유기간</th>
</tr>
</thead>
<tbody>
<tr>
<td>이용자 식별 및 본인여부 확인</td>
<td>아이디, 이름, 비밀번호</td>
<td>회원 탈퇴 시까지</td>
</tr>
<tr>
<td>고객서비스 이용에 관한 통지,<br>CS대응을 위한 이용자 식별</td>
<td>연락처 (이메일, 휴대전화번호)</td>
<td>회원 탈퇴 시까지</td>
</tr>
</tbody>
</table>
</div>
<fieldset class="fregister_agree"> <fieldset class="fregister_agree">
<label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label> <label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label>
<input type="checkbox" name="agree2" value="1" id="agree21"> <input type="checkbox" name="agree2" value="1" id="agree21">
+3
View File
@@ -89,6 +89,9 @@
#fregister .fregister_agree label {display:inline-block;margin-right:5px} #fregister .fregister_agree label {display:inline-block;margin-right:5px}
#fregister p {color:#e8180c;text-align:center} #fregister p {color:#e8180c;text-align:center}
#fregister .btn_confirm {margin-bottom:20px} #fregister .btn_confirm {margin-bottom:20px}
#fregister_private .tbl_head01 th{;text-align:center;border:1px solid #d1dee2;width:33%}
#fregister_private .tbl_head01 td {border:1px solid #e9e9e9}
#fregister_private .tbl_head01 caption{position:absolute;font-size:0;line-height:0;overflow:hidden}
/* 회원가입 입력 */ /* 회원가입 입력 */
#fregisterform textarea {height:50px} #fregisterform textarea {height:50px}
@@ -22,7 +22,30 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
<section id="fregister_private"> <section id="fregister_private">
<h2>개인정보처리방침안내</h2> <h2>개인정보처리방침안내</h2>
<textarea readonly><?php echo get_text($config['cf_privacy']) ?></textarea> <div class="tbl_head01 tbl_wrap">
<table>
<caption>개인정보처리방침안내</caption>
<thead>
<tr>
<th>목적</th>
<th>항목</th>
<th>보유기간</th>
</tr>
</thead>
<tbody>
<tr>
<td>이용자 식별 및 본인여부 확인</td>
<td>아이디, 이름, 비밀번호</td>
<td>회원 탈퇴 시까지</td>
</tr>
<tr>
<td>고객서비스 이용에 관한 통지,<br>CS대응을 위한 이용자 식별</td>
<td>연락처 (이메일, 휴대전화번호)</td>
<td>회원 탈퇴 시까지</td>
</tr>
</tbody>
</table>
</div>
<fieldset class="fregister_agree"> <fieldset class="fregister_agree">
<label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label> <label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label>
<input type="checkbox" name="agree2" value="1" id="agree21"> <input type="checkbox" name="agree2" value="1" id="agree21">
@@ -80,6 +80,10 @@
.fregister_agree label {display:inline-block;margin-right:5px} .fregister_agree label {display:inline-block;margin-right:5px}
#fregister p {color:#e8180c;text-align:center} #fregister p {color:#e8180c;text-align:center}
#fregister .btn_confirm {margin:15px 0} #fregister .btn_confirm {margin:15px 0}
#fregister_private .tbl_head01 {margin:0}
#fregister_private .tbl_head01 th{;text-align:center;border:1px solid #d1dee2;width:33%}
#fregister_private .tbl_head01 td {border:1px solid #e9e9e9;background:#fff}
#fregister_private .tbl_head01 caption{position:absolute;font-size:0;line-height:0;overflow:hidden;top:0;color:#fff}
/* 회원가입 입력 */ /* 회원가입 입력 */
#fregisterform #reg_mb_email, #fregisterform .frm_address {width:100%} #fregisterform #reg_mb_email, #fregisterform .frm_address {width:100%}
@@ -22,7 +22,31 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
<section id="fregister_private"> <section id="fregister_private">
<h2>개인정보처리방침안내</h2> <h2>개인정보처리방침안내</h2>
<textarea readonly><?php echo get_text($config['cf_privacy']) ?></textarea> <div class="tbl_head01 tbl_wrap">
<table>
<caption>개인정보처리방침안내</caption>
<thead>
<tr>
<th>목적</th>
<th>항목</th>
<th>보유기간</th>
</tr>
</thead>
<tbody>
<tr>
<td>이용자 식별 및 본인여부 확인</td>
<td>아이디, 이름, 비밀번호</td>
<td>회원 탈퇴 시까지</td>
</tr>
<tr>
<td>고객서비스 이용에 관한 통지,<br>CS대응을 위한 이용자 식별</td>
<td>연락처 (이메일, 휴대전화번호)</td>
<td>회원 탈퇴 시까지</td>
</tr>
</tbody>
</table>
</div>
<fieldset class="fregister_agree"> <fieldset class="fregister_agree">
<label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label> <label for="agree21">개인정보처리방침안내의 내용에 동의합니다.</label>
<input type="checkbox" name="agree2" value="1" id="agree21"> <input type="checkbox" name="agree2" value="1" id="agree21">
+3
View File
@@ -89,6 +89,9 @@
#fregister .fregister_agree label {display:inline-block;margin-right:5px} #fregister .fregister_agree label {display:inline-block;margin-right:5px}
#fregister p {color:#e8180c;text-align:center} #fregister p {color:#e8180c;text-align:center}
#fregister .btn_confirm {margin-bottom:20px} #fregister .btn_confirm {margin-bottom:20px}
#fregister_private .tbl_head01 th{;text-align:center;border:1px solid #d1dee2;width:33%}
#fregister_private .tbl_head01 td {border:1px solid #e9e9e9}
#fregister_private .tbl_head01 caption{position:absolute;font-size:0;line-height:0;overflow:hidden}
/* 회원가입 입력 */ /* 회원가입 입력 */
#fregisterform textarea {height:50px} #fregisterform textarea {height:50px}