From 990f765a838cb8a6770f1ebb9dbeb9c5725ff087 Mon Sep 17 00:00:00 2001 From: whitedot Date: Thu, 8 Aug 2013 11:22:57 +0900 Subject: [PATCH 01/20] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=EA=B3=B5?= =?UTF-8?q?=ED=86=B5:=20#488=20=EA=B2=8C=EC=8B=9C=EB=AC=BC=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=EB=B3=B5=EC=82=AC=20=EC=A0=84=EC=B2=B4=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EB=A7=88=ED=81=AC=EC=97=85=20=EB=B0=8F=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/move.php | 39 ++++++++++++++++++++------------------- css/default.css | 5 +++++ css/mobile.css | 5 +++++ 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/bbs/move.php b/bbs/move.php index d0c1faa53..46d85dcd4 100644 --- a/bbs/move.php +++ b/bbs/move.php @@ -59,31 +59,34 @@ for ($i=0; $row=sql_fetch_array($result); $i++) - + 게시판 - - + 현재게시판'; + $atc_bg = 'copymove_currentbg'; + } + ?> + - + @@ -92,7 +95,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
- +
@@ -100,9 +103,9 @@ for ($i=0; $row=sql_fetch_array($result); $i++) - - diff --git a/css/default.css b/css/default.css index d1ff348de..1b49dc9ef 100644 --- a/css/default.css +++ b/css/default.css @@ -93,6 +93,11 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline} #ft_copy b {color:#fff} #ft_copy a {position:absolute;top:10px;right:0;color:#fff} +/* 게시물 선택복사 선택이동 */ +#copymove {} +.copymove_current {float:right;color:#ff3061} +.copymove_currentbg {background:#f4f4f4} + /* 화면낭독기 사용자용 */ #hd_login_msg {position:absolute;top:0;left:0;font-size:0;line-height:0;overflow:hidden} .msg_sound_only, .sound_only {display:inline-block !important;position:absolute;top:0;left:0;margin:0 !important;padding:0 !important;font-size:0;line-height:0;border:0 !important;overflow:hidden !important} diff --git a/css/mobile.css b/css/mobile.css index 1f4b95373..7ddc2c901 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -92,6 +92,11 @@ pre {overflow-x:scroll;font-size:1.1em} #ft_copy b {color:#fff} #ft_copy a {color:#fff;text-decoration:none} +/* 게시물 선택복사 선택이동 */ +#copymove {} +.copymove_current {float:right;color:#ff3061} +.copymove_currentbg {background:#f4f4f4} + /* PC화면으로 */ #device_change {display:block;margin:0.3em;padding:0.5em 0;border:1px solid #eee;border-radius:2em;color:#000;font-size:1em;text-decoration:none;text-align:center} From 5a74ca5fbaaac7982c1eff27db6f74abcd371705 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Thu, 8 Aug 2013 11:38:26 +0900 Subject: [PATCH 02/20] =?UTF-8?q?jsboard=20=EC=9D=98=20maildaemon=20?= =?UTF-8?q?=EB=B0=8F=20=EA=B4=80=EB=A0=A8=20=ED=95=A8=EC=88=98=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=ED=96=88=EC=8A=B5=EB=8B=88=EB=8B=A4.=20?= =?UTF-8?q?=ED=95=9C=EB=A9=94=EC=9D=BC=EB=A1=9C=20=EB=A9=94=EC=9D=BC?= =?UTF-8?q?=EC=9D=B4=20=EB=B0=9C=EC=86=A1=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8D=98=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mailer.lib.php | 276 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 234 insertions(+), 42 deletions(-) diff --git a/lib/mailer.lib.php b/lib/mailer.lib.php index f6ee4e35b..6defb738c 100644 --- a/lib/mailer.lib.php +++ b/lib/mailer.lib.php @@ -3,57 +3,78 @@ if (!defined('_GNUBOARD_')) exit; // 메일 보내기 (파일 여러개 첨부 가능) // type : text=0, html=1, text+html=2 -function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file='', $cc='', $bcc='') -{ - global $config; - global $g4; +function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="") +{ + global $config; + global $g4; - // 메일발송 사용을 하지 않는다면 - if (!$config['cf_email_use']) return; + // 메일발송 사용을 하지 않는다면 + if (!$config['cf_email_use']) return; - $fname = "=?utf-8?B?" . base64_encode($fname) . "?="; - $subject = "=?utf-8?B?" . base64_encode($subject) . "?="; + $boundary = uniqid(time()); - $header = "Return-Path: <$fmail>\n"; - $header .= "From: $fname <$fmail>\n"; - $header .= "Reply-To: <$fmail>\n"; - if ($cc) $header .= "Cc: $cc\n"; - if ($bcc) $header .= "Bcc: $bcc\n"; - $header .= "MIME-Version: 1.0\n"; - $header .= "X-Mailer: {$_SERVER['SERVER_ADDR']} : {$_SERVER['REMOTE_ADDR']} : ".G4_URL." : {$_SERVER['PHP_SELF']} : {$_SERVER['HTTP_REFERER']} \n"; + $header = "Message-ID: <".generate_mail_id(preg_replace("/@.+$/i","",$to)).">\r\n". + "From:=?utf-8?B?".base64_encode($fname)."?=<$fmail>\r\n"; + if ($cc) $header .= "Cc: $cc\n"; + if ($bcc) $header .= "Bcc: $bcc\n"; + $header .= "MIME-Version: 1.0\n"; + $header .= "X-Mailer: SIR Mailer 0.94 : {$_SERVER['SERVER_ADDR']} : {$_SERVER['REMOTE_ADDR']} : ".G4_URL." : {$_SERVER['PHP_SELF']} : {$_SERVER['HTTP_REFERER']} \n"; + $header .= "Date: ".date ("D, j M Y H:i:s T",time())."\r\n". + "To: $to\r\n". + "Subject: =?utf-8?B?".base64_encode($subject)."?=\r\n"; - if ($file != '') { - $boundary = uniqid('http://sir.co.kr/'); - - $header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n"; - $header .= "--$boundary\n"; - } - - if ($type) { - $header .= "Content-Type: TEXT/HTML; charset=utf-8\n"; - if ($type == 2) - $content = nl2br($content); + if ($file == "") { + $header .= "Content-Type: MULTIPART/ALTERNATIVE;\n". + " BOUNDARY=\"$boundary\"\n\n"; } else { - $header .= "Content-Type: TEXT/PLAIN; charset=utf-8\n"; - $content = stripslashes($content); + $header .= "Content-Type: MULTIPART/MIXED;\n". + " BOUNDARY=\"$boundary\"\n\n"; } - $header .= "Content-Transfer-Encoding: BASE64\n\n"; - $header .= chunk_split(base64_encode($content)) . "\n"; - if ($file != '') { - foreach ($file as $f) { - $header .= "\n--$boundary\n"; - $header .= "Content-Type: APPLICATION/OCTET-STREAM; name=\"{$f['name']}\"\n"; - $header .= "Content-Transfer-Encoding: BASE64\n"; - $header .= "Content-Disposition: inline; filename=\"{$f['name']}\"\n"; + if ($type == 2) + $content = nl2br($content); - $header .= "\n"; - $header .= chunk_split(base64_encode($f['data'])); - $header .= "\n"; - } - $header .= "--$boundary--\n"; + $strip_content = stripslashes(trim($content)); + $encode_content = chunk_split(base64_encode($strip_content)); + + $body = ""; + $body .= "\n--$boundary\n"; + $body .= "Content-Type: TEXT/PLAIN; charset=utf-8\n"; + $body .= "Content-Transfer-Encoding: BASE64\n\n"; + $body .= $encode_content; + $body .= "\n--$boundary\n"; + + if ($type) { + $body .= "Content-Type: TEXT/HTML; charset=utf-8\n"; + $body .= "Content-Transfer-Encoding: BASE64\n\n"; + $body .= $encode_content; + $body .= "\n--$boundary\n"; + } + + if ($file != "") { + foreach ($file as $f) { + $body .= "n--$boundary\n"; + $body .= "Content-Type: APPLICATION/OCTET-STREAM; name=$fname\n"; + $body .= "Content-Transfer-Encoding: BASE64\n"; + $body .= "Content-Disposition: inline; filename=$fname\n"; + + $body .= "\n"; + $body .= chunk_split(base64_encode($f['data'])); + $body .= "\n"; + } + $body .= "--$boundary--\n"; + } + + $mails['to'] = $to; + $mails['from'] = $fmail; + $mails['text'] = $header.$body; + + if (defined(G4_SMTP)) { + ini_set('SMTP', G4_SMTP); + @mail($to, $subject, $body, $header, "-f $fmail"); + } else { + new maildaemon($mails); } - @mail($to, $subject, "", $header); } // 파일 첨부시 @@ -167,4 +188,175 @@ function verify_email($address, &$error) $error = '메일 교환기에 도달하지 못하였습니다.'; return false; } + + +# jsboard 의 메일보내기 class를 추가합니다. 130808 + +# mail 보내기 함수 2001.11.30 김정균 +# $Id: include/sendmail.php,v 1.4 2009/11/19 05:29:51 oops Exp $ + +# 서버상의 smtp daemon 에 의존하지 않고 직접 발송하는 smtp class +# +# 특정 배열로 class 에 전달을 하여 메일을 발송한다. 배열은 아래을 참조한다. +# +# debug -> debug 를 할지 안할지를 결정한다. +# ofhtml -> 웹상에서 사용할지 쉘상에서 사용할지를 결정한다. +# from -> 메일을 발송하는 사람의 메일주소 +# to -> 메일을 받을 사람의 메일 주소 +# text -> 헤더 내용을 포함한 메일 본문 +# +class maildaemon { + var $failed = 0; + + function __construct($v) { + $this->debug = $v['debug']; + $this->ofhtml = $v['ofhtml']; + if($_SERVER['SERVER_NAME']) $this->helo = $_SERVER['SERVER_NAME']; + if(!$this->helo || preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/i",$this->helo)) + $this->helo = "JSBoardMessage"; + + $this->from = $v['from']; + $this->to = $v['to']; + $this->body = $v['text']."\r\n."; + + //die($v['text']); + $this->newline = $this->ofhtml ? "
\n" : "\n"; + + $this->mx = $this->getMX($this->to); + + if($this->debug) { + echo "DEBUG: ".$this->mx." start".$this->newline; + echo "################################################################".$this->newline; + } + $this->sockets("open"); + $this->send("HELO ".$this->helo); + $this->send("MAIL FROM: <".$this->from.">"); + $this->send("RCPT TO: <".$this->to.">"); + $this->send("data"); + $this->send($this->body); + $this->send("quit"); + $this->sockets("close"); + } + + function getMX($email) { + $dev = explode("@",$email); + $account = $dev[0]; + $host = $dev[1]; + + if(checkdnsrr($host,"MX") && getmxrr($host,$mx,$weight)) { + $idx = 0; + for($i=0;$i $weight[$i]) { + $dest = $weight[$i]; + $idx = $i; + } + } + } else return $host; + return $mx[$idx]; + } + + # 디버그 함수 + # $t -> 1 (debug of socket open,close) + # 0 (regular smtp message) + # $p -> 1 (print detail debug) + # + # return 1 -> success + # return 0 -> failed + # + function debug($str,$t=0,$p=0) { + if($t) { + if(!$str) $this->failed = 1; + if($this->sock) $returnmsg = trim(fgets($this->sock,1024)); + } else { + if(!preg_match("/^(220|221|250|251|354)$/",substr(trim($str),0,3))) + $this->failed = 1; + } + + # DEBUG mode -> 모든 메세지 출력 + if($p) { + if($t) { + $str = "Conncet ".$this->mx; + $str .= $this->failed ? " Failed" : " Success"; + $str .= $this->newline."DEBUG: $returnmsg"; + } + echo "DEBUG: $str".$this->newline; + } + + # DEBUG 모드가 아닐때, 에러 메세지 출력 + if(!$p && $this->failed) { + if($this->ofhtml) echo "\n"; + else "ERROR: $str\n"; + } + } + + function sockets($option=0) { + switch($option) { + case "open" : + $this->sock = @fsockopen($this->mx,25,$this->errno,$this->errstr,30); + $this->debug($this->sock,1,$this->debug); + break; + default : + if($this->sock) fclose($this->sock); + break; + } + } + + function send($str,$chk=0) { + if(!$this->failed) { + if($this->debug) { + if(preg_match("/\r\n/",trim($str))) + $str_debug = trim(str_replace("\r\n","\r\n ",$str)); + else $str_debug = $str; + } + fputs($this->sock,"$str\r\n"); + $recv = trim(fgets($this->sock,1024)); + $recvchk = $recv; + $this->debug($recv,0,$this->debug); + + if(preg_match("/Mail From:/i",$str) && preg_match("/exist|require|error/i",$recvchk) && !$chk) { + $this->failed = 0; + $this->send("MAIL FROM: <".$this->to.">",1); + } + } + } +} + + +function generate_mail_id($uid) { + $id = date("YmdHis",time()); + mt_srand((float) microtime() * 1000000); + $randval = mt_rand(); + $id .= $randval."@$uid"; + return $id; +} + + +function mail_header($to,$from,$title,$mta=0) { + global $langs,$boundary; + + # mail header 를 작성 + $boundary = get_boundary_msg(); + $header = "Message-ID: <".generate_mail_id(preg_replace("/@.+$/i","",$to)).">\r\n". + "From:=?utf-8?B?".base64_encode('보내는사람')."?=<$from>\r\n". + "MIME-Version: 1.0\r\n"; + + if(!$mta) $header .= "Date: ".date ("D, j M Y H:i:s T",time())."\r\n". + "To: $to\r\n". + "Subject: $title\r\n"; + + $header .= "Content-Type: multipart/alternative;\r\n". + " boundary=\"$boundary\"\r\n\r\n"; + + return $header; +} + + +function get_boundary_msg() { + $uniqchr = uniqid(""); + $one = strtoupper($uniqchr[0]); + $two = strtoupper(substr($uniqchr,0,8)); + $three = strtoupper(substr(strrev($uniqchr),0,8)); + return "----=_NextPart_000_000${one}_${two}.${three}"; +} ?> \ No newline at end of file From 6a88e2078742e21e40892f5a826fcfe001ebb2fe Mon Sep 17 00:00:00 2001 From: gnuboard Date: Thu, 8 Aug 2013 11:39:07 +0900 Subject: [PATCH 03/20] =?UTF-8?q?G4=5FSMTP=20=EC=83=81=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20lib/mailer.lib.php=20=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config.php b/config.php index a55c219b6..692b9876d 100644 --- a/config.php +++ b/config.php @@ -135,6 +135,11 @@ define('G4_FILE_PERMISSION', 0644); // 파일 생성시 퍼미션 // 모바일 인지 결정 $_SERVER['HTTP_USER_AGENT'] define('G4_MOBILE_AGENT', 'phone|samsung|lgtel|mobile|skt|nokia|blackberry|android|sony'); +// SMTP +// lib/mailer.lib.php 에서 사용 +define('G4_SMTP', '127.0.0.1'); + + /******************** 기타 상수 ********************/ From 1324a7f2e011044c1f6864d4fe2bd38dc662917e Mon Sep 17 00:00:00 2001 From: gnuboard Date: Thu, 8 Aug 2013 11:39:47 +0900 Subject: [PATCH 04/20] =?UTF-8?q?=EB=A9=94=EC=9D=BC=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=95=88=EB=82=B4=EB=A9=94=EC=84=B8?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/login_check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbs/login_check.php b/bbs/login_check.php index 9f5378e2b..70339f262 100644 --- a/bbs/login_check.php +++ b/bbs/login_check.php @@ -31,7 +31,7 @@ if ($mb['mb_leave_date'] && $mb['mb_leave_date'] <= date("Ymd", G4_SERVER_TIME)) } if ($config['cf_use_email_certify'] && !preg_match("/[1-9]/", $mb['mb_email_certify'])) { - confirm("{$mb['mb_email']} 메일로 메일인증을 받으셔야 로그인 가능합니다. 다른 메일주소로 인증하시려면 취소를 클릭하시기 바랍니다.", G4_URL, G4_BBS_URL.'/register_email.php?mb_id='.$mb_id); + confirm("{$mb['mb_email']} 메일로 메일인증을 받으셔야 로그인 가능합니다. 다른 메일주소로 변경하여 인증하시려면 취소를 클릭하시기 바랍니다.", G4_URL, G4_BBS_URL.'/register_email.php?mb_id='.$mb_id); } @include_once($member_skin_path.'/login_check.skin.php'); From 8a297052075228c5b796e20ab24254d925853c1a Mon Sep 17 00:00:00 2001 From: gnuboard Date: Thu, 8 Aug 2013 11:44:40 +0900 Subject: [PATCH 05/20] =?UTF-8?q?=EA=B4=80=EB=A6=AC=EC=9E=90=20=EB=A9=94?= =?UTF-8?q?=EC=9D=BC=EC=A3=BC=EC=86=8C=20=EC=B6=94=EA=B0=80,=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=EA=B0=80=EC=9E=85=EC=8B=9C=EB=82=98=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=A9=94=EC=9D=BC=20=EB=B0=9C=EC=86=A1?= =?UTF-8?q?=EC=8B=9C=EC=97=90=20=EB=B3=B4=EB=82=B4=EA=B1=B0=EB=82=98=20?= =?UTF-8?q?=EB=B0=9B=EB=8A=94=20=EC=9A=A9=EB=8F=84=EB=A1=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EB=90=A9=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/config_form.php | 18 ++- adm/config_form_update.php | 229 +++++++++++++++++----------------- adm/mail_select_list.php | 2 - adm/mail_select_update.php | 14 +-- adm/sendmail_test.php | 15 +-- bbs/register_email_update.php | 8 +- bbs/register_form_update.php | 10 +- install/gnuboard4s.sql | 1 + 8 files changed, 150 insertions(+), 147 deletions(-) diff --git a/adm/config_form.php b/adm/config_form.php index a1f041388..3c2322602 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -101,6 +101,11 @@ if(!sql_query(" DESC {$g4['autosave_table']} ", false)) { ) ", false); } +if(!isset($config['cf_admin_email'])) { + sql_query(" ALTER TABLE `{$g4['config_table']}` + ADD `cf_admin_email` VARCHAR(255) NOT NULL AFTER `cf_admin` ", true); +} + $g4['title'] = '환경설정'; include_once ('./admin.head.php'); @@ -136,9 +141,18 @@ $pg_anchor = '