Skip to content

Commit

Permalink
캡챠 오류 수정 및 파일명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
chicpro committed Nov 17, 2015
1 parent c0cd45c commit 614dce6
Show file tree
Hide file tree
Showing 8 changed files with 332 additions and 27 deletions.
20 changes: 14 additions & 6 deletions css/default.css
Expand Up @@ -119,17 +119,25 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
/* ie6 이미지 너비 지정 */
.img_fix {width:100%;height:auto}

/* 캡챠 자동등록(입력)방지 기본 */
/* 캡챠 자동등록(입력)방지 기본 -pc */
#captcha {display:inline-block;position:relative}
#captcha legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden}
#captcha #captcha_img {width:160px;height:60px;border:1px solid #e9e9e9}
#captcha legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden;}
#captcha #captcha_img {width:160px;height:60px;border:1px solid #e9e9e9;vertical-align:top;padding:0;margin:0}
#captcha #captcha_mp3 {position:absolute;top:0;left:161px;;margin:0;padding:0;width:31px;height:31px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer}
#captcha #captcha_mp3 span {position:absolute;top:0;left:0;width:31px;height:31px;background:url('../img/captcha.png') no-repeat;}
#captcha #captcha_reload {position:absolute;top:31px;left:161px;margin:0;padding:0;width:31px;height:31px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer}
#captcha #captcha_reload span {position:absolute;top:0;left:0;width:31px;height:31px;background:url('../img/captcha.png') no-repeat 0 -30px;border-top:1px solid #ccc}
#captcha #captcha_key {margin:0 0 0 33px;padding:0 5px;width:70px;height:60px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2.8em}
#captcha #captcha_reload {position:absolute;top:31px;left:161px;margin:0;padding:0;width:31px;height:31px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer;background:url('../img/captcha.png') no-repeat 0 -30px;border-top:1px solid #ccc;text-indent:-999px}
#captcha #captcha_key {margin:0 0 0 33px;padding:0 5px;width:70px;height:60px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2.8em;vertical-align:top}
#captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}

/* 캡챠 자동등록(입력)방지 기본 - mobile */
#captcha.m_captcha audio {display:block;margin:0 0 5px;width:187px}
#captcha.m_captcha #captcha_img {width:160px;height:60px;border:1px solid #e9e9e9;margin-bottom:3px;margin-top:5px;display:block;}
#captcha.m_captcha #captcha_reload {position:static;margin:0;padding:0;width:31px;height:31px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer;background:url('../../../img/captcha.png') no-repeat 0 -30px;text-indent:-999px}
#captcha.m_captcha #captcha_reload span{display:none;}
#captcha.m_captcha #captcha_key {margin:0;padding:0 5px;width:115px;height:29px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:29px;margin-left:3px}
#captcha.m_captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
#captcha.m_captcha #captcha_mp3 {width:31px;height:31px;background:url('../img/captcha.png') no-repeat; vertical-align:top;overflow:hidden;cursor:pointer;text-indent:-9999px;border:none}

/* ckeditor 단축키 */
.cke_sc {margin:0 0 5px;text-align:right}
.btn_cke_sc{display:inline-block;padding:0 10px;height:23px;border:1px solid #ccc;background:#fafafa;color:#000;text-decoration:none;line-height:1.9em;vertical-align:middle;cursor:pointer}
Expand Down
17 changes: 13 additions & 4 deletions css/mobile.css
Expand Up @@ -53,7 +53,7 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
#hd_sch {display:none;border-top:1px solid #181818;background:#282828;text-align:center}
#hd_sch h2 {position:absolute;font-size:0;text-indent:-9999em;line-height:0;overflow:hidden}
#hd_sch form {position:relative;padding:30px 0}
#hd_sch #sch_stx {height:30px;border:1px solid #181818;background:#323232 !important;line-height:2.5em;vertical-align:middle}
#hd_sch #sch_stx {height:30px;border:1px solid #181818;background:#323232 !important;line-height:2.5em;vertical-align:middle;color:#ccc}
#hd_sch #sch_submit {margin:0;padding:0 10px;height:32px;border:0;background:#000;color:#fff;vertical-align:middle}
#hd_sch #sch_close {display:block;margin:0;padding:10px 0;width:100%;border:0;background:#000;color:#fff}

Expand Down Expand Up @@ -109,16 +109,25 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
/* 이미지 등비율 리사이징 */
.img_fix {width:100%;height:auto}

/* 캡챠 자동등록(입력)방지 기본 */
/* 캡챠 자동등록(입력)방지 기본 - PC */
#captcha {display:inline-block;position:relative;}
#captcha legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden;font-size:0}
#captcha audio {display:block;margin:0 0 5px;width:187px}
#captcha #captcha_img {width:160px;height:60px;border:1px solid #e9e9e9;margin-bottom:3px;margin-right:32px;}
#captcha #captcha_img {width:160px;height:60px;border:1px solid #e9e9e9;margin-bottom:3px;margin-right:32px;vertical-align:top}
#captcha #captcha_reload {position:absolute;top:31px;left:161px;width:31px;height:31px;background:url('../img/captcha.png') no-repeat 0 -30px;border:none;border-top:1px solid #ccc;overflow:hidden;cursor:pointer;text-indent:-9999px;}
#captcha #captcha_key {margin:0;padding:0 5px;width:70px;height:60px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2.8em}
#captcha #captcha_key {margin:0;padding:0 5px;width:70px;height:60px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2.8em;vertical-align:top}
#captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
#captcha #captcha_mp3 {position:absolute;top:0;left:161px;width:31px;height:31px;background:url('../img/captcha.png') no-repeat; vertical-align:top;overflow:hidden;cursor:pointer;text-indent:-9999px;border:none}

/* 캡챠 자동등록(입력)방지 기본 - mobile */
#captcha.m_captcha legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden;font-size:0}
#captcha.m_captcha audio {display:block;margin:0 0 5px;width:187px}
#captcha.m_captcha #captcha_img {width:160px;height:60px;border:1px solid #e9e9e9;margin-bottom:3px;display:block;}
#captcha.m_captcha #captcha_reload {width:31px;height:31px;background:url('../img/captcha.png') no-repeat 0 -30px;border:none;overflow:hidden;cursor:pointer;text-indent:-9999px;position:static}
#captcha.m_captcha #captcha_key {margin:0;padding:0 5px;width:115px;height:29px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:29px;margin-left:3px}
#captcha.m_captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
#captcha.m_captcha #captcha_mp3 {width:31px;height:31px;background:url('../img/captcha.png') no-repeat; vertical-align:top;overflow:hidden;cursor:pointer;text-indent:-9999px;border:none}



/*단축키일람 */
Expand Down
Binary file removed lib/Excel/itemexcel.xls
Binary file not shown.
271 changes: 271 additions & 0 deletions lib/Excel/oleread.inc.php
@@ -0,0 +1,271 @@
<?php
define('NUM_BIG_BLOCK_DEPOT_BLOCKS_POS', 0x2c);
define('SMALL_BLOCK_DEPOT_BLOCK_POS', 0x3c);
define('ROOT_START_BLOCK_POS', 0x30);
define('BIG_BLOCK_SIZE', 0x200);
define('SMALL_BLOCK_SIZE', 0x40);
define('EXTENSION_BLOCK_POS', 0x44);
define('NUM_EXTENSION_BLOCK_POS', 0x48);
define('PROPERTY_STORAGE_BLOCK_SIZE', 0x80);
define('BIG_BLOCK_DEPOT_BLOCKS_POS', 0x4c);
define('SMALL_BLOCK_THRESHOLD', 0x1000);
// property storage offsets
define('SIZE_OF_NAME_POS', 0x40);
define('TYPE_POS', 0x42);
define('START_BLOCK_POS', 0x74);
define('SIZE_POS', 0x78);
define('IDENTIFIER_OLE', pack("CCCCCCCC",0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1));

//echo 'ROOT_START_BLOCK_POS = '.ROOT_START_BLOCK_POS."\n";

//echo bin2hex($data[ROOT_START_BLOCK_POS])."\n";
//echo "a=";
//echo $data[ROOT_START_BLOCK_POS];
//function log

function GetInt4d($data, $pos)
{
$value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24);
if ($value>=4294967294)
{
$value=-2;
}
return $value;
}


class OLERead {
var $data = '';


function OLERead(){


}

function read($sFileName){

// check if file exist and is readable (Darko Miljanovic)
if(!is_readable($sFileName)) {
$this->error = 1;
return false;
}

$this->data = @file_get_contents($sFileName);
if (!$this->data) {
$this->error = 1;
return false;
}
//echo IDENTIFIER_OLE;
//echo 'start';
if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {
$this->error = 1;
return false;
}
$this->numBigBlockDepotBlocks = GetInt4d($this->data, NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
$this->sbdStartBlock = GetInt4d($this->data, SMALL_BLOCK_DEPOT_BLOCK_POS);
$this->rootStartBlock = GetInt4d($this->data, ROOT_START_BLOCK_POS);
$this->extensionBlock = GetInt4d($this->data, EXTENSION_BLOCK_POS);
$this->numExtensionBlocks = GetInt4d($this->data, NUM_EXTENSION_BLOCK_POS);

/*
echo $this->numBigBlockDepotBlocks." ";
echo $this->sbdStartBlock." ";
echo $this->rootStartBlock." ";
echo $this->extensionBlock." ";
echo $this->numExtensionBlocks." ";
*/
//echo "sbdStartBlock = $this->sbdStartBlock\n";
$bigBlockDepotBlocks = array();
$pos = BIG_BLOCK_DEPOT_BLOCKS_POS;
// echo "pos = $pos";
$bbdBlocks = $this->numBigBlockDepotBlocks;

if ($this->numExtensionBlocks != 0) {
$bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
}

for ($i = 0; $i < $bbdBlocks; $i++) {
$bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos);
$pos += 4;
}


for ($j = 0; $j < $this->numExtensionBlocks; $j++) {
$pos = ($this->extensionBlock + 1) * BIG_BLOCK_SIZE;
$blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, BIG_BLOCK_SIZE / 4 - 1);

for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; $i++) {
$bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos);
$pos += 4;
}

$bbdBlocks += $blocksToRead;
if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
$this->extensionBlock = GetInt4d($this->data, $pos);
}
}

// var_dump($bigBlockDepotBlocks);

// readBigBlockDepot
$pos = 0;
$index = 0;
$this->bigBlockChain = array();

for ($i = 0; $i < $this->numBigBlockDepotBlocks; $i++) {
$pos = ($bigBlockDepotBlocks[$i] + 1) * BIG_BLOCK_SIZE;
//echo "pos = $pos";
for ($j = 0 ; $j < BIG_BLOCK_SIZE / 4; $j++) {
$this->bigBlockChain[$index] = GetInt4d($this->data, $pos);
$pos += 4 ;
$index++;
}
}

//var_dump($this->bigBlockChain);
//echo '=====2';
// readSmallBlockDepot();
$pos = 0;
$index = 0;
$sbdBlock = $this->sbdStartBlock;
$this->smallBlockChain = array();

while ($sbdBlock != -2) {

$pos = ($sbdBlock + 1) * BIG_BLOCK_SIZE;

for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) {
$this->smallBlockChain[$index] = GetInt4d($this->data, $pos);
$pos += 4;
$index++;
}

$sbdBlock = $this->bigBlockChain[$sbdBlock];
}


// readData(rootStartBlock)
$block = $this->rootStartBlock;
$pos = 0;
$this->entry = $this->__readData($block);

/*
while ($block != -2) {
$pos = ($block + 1) * BIG_BLOCK_SIZE;
$this->entry = $this->entry.substr($this->data, $pos, BIG_BLOCK_SIZE);
$block = $this->bigBlockChain[$block];
}
*/
//echo '==='.$this->entry."===";
$this->__readPropertySets();

}

function __readData($bl) {
$block = $bl;
$pos = 0;
$data = '';

while ($block != -2) {
$pos = ($block + 1) * BIG_BLOCK_SIZE;
$data = $data.substr($this->data, $pos, BIG_BLOCK_SIZE);
//echo "pos = $pos data=$data\n";
$block = $this->bigBlockChain[$block];
}
return $data;
}

function __readPropertySets(){
$offset = 0;
//var_dump($this->entry);
while ($offset < strlen($this->entry)) {
$d = substr($this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE);

$nameSize = ord($d[SIZE_OF_NAME_POS]) | (ord($d[SIZE_OF_NAME_POS+1]) << 8);

$type = ord($d[TYPE_POS]);
//$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1;

$startBlock = GetInt4d($d, START_BLOCK_POS);
$size = GetInt4d($d, SIZE_POS);

$name = '';
for ($i = 0; $i < $nameSize ; $i++) {
$name .= $d[$i];
}

$name = str_replace("\x00", "", $name);

$this->props[] = array (
'name' => $name,
'type' => $type,
'startBlock' => $startBlock,
'size' => $size);

if (($name == "Workbook") || ($name == "Book")) {
$this->wrkbook = count($this->props) - 1;
}

if ($name == "Root Entry") {
$this->rootentry = count($this->props) - 1;
}

//echo "name ==$name=\n";


$offset += PROPERTY_STORAGE_BLOCK_SIZE;
}

}


function getWorkBook(){
if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD){
// getSmallBlockStream(PropertyStorage ps)

$rootdata = $this->__readData($this->props[$this->rootentry]['startBlock']);

$streamData = '';
$block = $this->props[$this->wrkbook]['startBlock'];
//$count = 0;
$pos = 0;
while ($block != -2) {
$pos = $block * SMALL_BLOCK_SIZE;
$streamData .= substr($rootdata, $pos, SMALL_BLOCK_SIZE);

$block = $this->smallBlockChain[$block];
}

return $streamData;


}else{

$numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE;
if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) {
$numBlocks++;
}

if ($numBlocks == 0) return '';

//echo "numBlocks = $numBlocks\n";
//byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE];
//print_r($this->wrkbook);
$streamData = '';
$block = $this->props[$this->wrkbook]['startBlock'];
//$count = 0;
$pos = 0;
//echo "block = $block";
while ($block != -2) {
$pos = ($block + 1) * BIG_BLOCK_SIZE;
$streamData .= substr($this->data, $pos, BIG_BLOCK_SIZE);
$block = $this->bigBlockChain[$block];
}
//echo 'stream'.$streamData;
return $streamData;
}
}

}
?>
2 changes: 1 addition & 1 deletion lib/Excel/reader.php
Expand Up @@ -28,7 +28,7 @@


//require_once 'PEAR.php';
require_once 'oleread.inc';
require_once 'oleread.inc.php';
//require_once 'OLE.php';

define('SPREADSHEET_EXCEL_READER_BIFF8', 0x600);
Expand Down
6 changes: 5 additions & 1 deletion plugin/kcaptcha/kcaptcha.lib.php
Expand Up @@ -237,14 +237,18 @@ function setKeyString($str){
// 캡챠 HTML 코드 출력
function captcha_html($class="captcha")
{
if(is_mobile())
$class .= ' m_captcha';

$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
//$html .= "\n".'<script>var g5_captcha_path = "'.G5_CAPTCHA_PATH.'";</script>';
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/kcaptcha.js"></script>';
$html .= "\n".'<fieldset id="captcha" class="'.$class.'">';
$html .= "\n".'<legend><label for="captcha_key">자동등록방지</label></legend>';
if (is_mobile()) $html .= '<audio src="#" id="captcha_audio" controls></audio>';
//$html .= "\n".'<img src="#" alt="" id="captcha_img">';
$html .= "\n".'<img src="javascript:void(0);" alt="" id="captcha_img">';
$html .= "\n".'<button type="button" id="captcha_mp3"><span></span>숫자음성듣기</button>';
if (!is_mobile()) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>숫자음성듣기</button>';
$html .= "\n".'<button type="button" id="captcha_reload"><span></span>새로고침</button>';
$html .= '<input type="text" name="captcha_key" id="captcha_key" required class="captcha_box required" size="6" maxlength="6">';
$html .= "\n".'<span id="captcha_info">자동등록방지 숫자를 순서대로 입력하세요.</span>';
Expand Down

0 comments on commit 614dce6

Please sign in to comment.