Merge branch 'master' of github.com:gnuboard/g5 into g5

This commit is contained in:
chicpro
2014-12-17 10:13:04 +09:00
6 changed files with 7 additions and 152 deletions

View File

@ -58,6 +58,7 @@ $sql = " insert into {$g5['board_table']}
bo_use_rss_view = '{$board[bo_use_rss_view]}',
bo_use_good = '{$board[bo_use_good]}',
bo_use_nogood = '{$board[bo_use_nogood]}',
bo_use_name = '{$board[bo_use_name]}',
bo_use_signature = '{$board[bo_use_signature]}',
bo_use_ip_view = '{$board[bo_use_ip_view]}',
bo_use_list_view = '{$board['bo_use_list_view']}',
@ -179,10 +180,10 @@ if (count($file_copy)) {
set bo_table = '$target_table',
wr_id = '{$file_copy[$i]['wr_id']}',
bf_no = '{$file_copy[$i]['bf_no']}',
bf_source = '{$file_copy[$i]['bf_source']}',
bf_source = '".addslashes($file_copy[$i]['bf_source'])."',
bf_file = '{$file_copy[$i]['bf_file']}',
bf_download = '{$file_copy[$i]['bf_download']}',
bf_content = '{$file_copy[$i]['bf_content']}',
bf_content = '".addslashes($file_copy[$i]['bf_content'])."',
bf_filesize = '{$file_copy[$i]['bf_filesize']}',
bf_width = '{$file_copy[$i]['bf_width']}',
bf_height = '{$file_copy[$i]['bf_height']}',

View File

@ -121,7 +121,7 @@ while ($row = sql_fetch_array($result))
set bo_table = '$move_bo_table',
wr_id = '$insert_id',
bf_no = '{$row3['bf_no']}',
bf_source = '{$row3['bf_source']}',
bf_source = '".addslashes($row3['bf_source'])."',
bf_file = '{$row3['bf_file']}',
bf_download = '{$row3['bf_download']}',
bf_content = '".addslashes($row3['bf_content'])."',

View File

@ -266,7 +266,6 @@ $_SESSION['ss_is_mobile'] = $is_mobile;
define('G5_IS_MOBILE', $is_mobile);
define('G5_DEVICE_BUTTON_DISPLAY', $set_device);
if (G5_IS_MOBILE) {
include_once(G5_LIB_PATH.'/mobile.lib.php'); // 모바일 전용 라이브러리
$g5['mobile_path'] = G5_PATH.'/'.$g5['mobile_dir'];
}
//==============================================================================

View File

@ -17,8 +17,8 @@ else {
// 게시판 제목에 ' 포함되면 오류 발생
$g5['lo_location'] = addslashes($g5['title']);
if (!$g5['lo_location'])
$g5['lo_location'] = $_SERVER['REQUEST_URI'];
$g5['lo_url'] = $_SERVER['REQUEST_URI'];
$g5['lo_location'] = addslashes($_SERVER['REQUEST_URI']);
$g5['lo_url'] = addslashes($_SERVER['REQUEST_URI']);
if (strstr($g5['lo_url'], '/'.G5_ADMIN_DIR.'/') || $is_admin == 'super') $g5['lo_url'] = '';
/*

View File

@ -1,145 +0,0 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// 원본 이미지를 넘기면 비율에 따라 썸네일 이미지를 생성함
function mobile_create_thumb($srcImg, $width, $thumb)
{
$size = @getimagesize($srcImg);
if ($size[2] == 1)
$source = @imagecreatefromgif($srcImg);
else if ($size[2] == 2)
$source = @imagecreatefromjpeg($srcImg);
else if ($size[2] == 3)
$source = @imagecreatefrompng($srcImg);
else
return "";
if (!$source)
return "";
if ($size[0] < $width) {
$width = $size[0];
$height = $size[1];
}
else {
$rate = $width / $size[0];
$height = (int)($size[1] * $rate);
}
$target = @imagecreatetruecolor($width, $height);
$bgcolor = @imagecolorallocate($target, 255, 255, 255); // 썸네일 배경
imagefilledrectangle($target, 0, 0, $width, $height, $bgcolor);
imagecopyresampled($source, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagecopy($target, $source, 0, 0, 0, 0, $size[0], $size[1]);
imagejpeg($target, $thumb, 100);
chmod($thumb, G5_FILE_PERMISSION); // 추후 삭제를 위하여 파일모드 변경
return $thumb;
}
function mobile_thumb($matches)
{
global $is_admin;
global $g5, $bo_table, $wr_id;
$width = 300; // (소스이미지 width pixel)
//if ($is_admin) print_r2($matches);
if ($is_admin) {
foreach ($matches as $img) {
echo "<p>";
preg_match("/src=[\"\']?([^\"\'\s>]+)/i", $img, $m);
$src = trim($m[1]);
//echo $src;
// 상대경로(..)로 시작되면 sir.co.kr 도메인으로 여긴다.
$src = preg_replace("/^\.\.\//", "http://m.sir.co.kr/", $src);
$absolute = preg_replace("/^http\:\/\/(www\.)?sir\.co\.kr\/(.*)$/", "/home/sir/$2", $src);
$thumb_dir = G5_DATA_PATH.'/thumb/'.$bo_table;
if (!is_dir($thumb_dir)) {
@mkdir($thumb_dir, G5_DIR_PERMISSION);
@chmod($thumb_dir, G5_DIR_PERMISSION);
}
$result = true;
if (preg_match("/\.(jpe?g|png)$/i", $src)) {
// 유일한 파일명을 만든다.
$src_md5 = md5($src.$width);
$thumb = "$thumb_dir/{$wr_id}-{$src_md5}";
if (!file_exists($thumb)) {
$result = mobile_create_thumb($src, $width, $thumb);
}
}
else {
$thumb = $src;
}
if ($result) {
$size = @getimagesize($absolute);
if ($size[2] == IMAGETYPE_GIF)
$w = ($size[0] < $width) ? $size[0] : $width;
else
$w = ($size[0] < $width) ? $size[0] : "100%";
return "<img src='$thumb' width='$w' />";
}
}
} else {
foreach ($matches as $img) {
preg_match("/src=[\"\']?([^\"\'\s>]+)/i", $img, $m);
$result = true;
$src = trim($m[1]);
//if ($is_admin) echo $src."<br>";
if (preg_match("/\.(jpe?g|png)$/i", $src)) {
// 상대경로(..)로 시작되면 도메인으로 여긴다.
$src = preg_replace("/^\.\.\//", 'http://'.$_SERVER['SERVER_NAME'].'/', $src);
// 유일한 파일명을 만든다.
$src_md5 = md5($src.$width);
$thumb = G5_DATA_PATH.'/thumb/'.$bo_table.'-'.$wr_id.'-'.$src_md5;
if (!file_exists($thumb)) {
$result = mobile_create_thumb($src, $width, $thumb);
}
}
else {
$thumb = $src;
}
if ($result) {
//if ($is_admin) { $begin_time = get_microtime(); }
//echo $thumb;
$size = @getimagesize($thumb);
//if ($is_admin) print_r2($size);
if ($size[2] == IMAGETYPE_GIF)
$w = ($size[0] < $width) ? $size[0] : $width;
else
$w = ($size[0] < $width) ? $size[0] : "100%";
//if ($is_admin) { echo "<p>time : "; echo get_microtime() - $begin_time; }
return "<img src='$thumb' width='$w' />";
}
}
}
}
function mobile_embed($matches)
{
foreach ($matches as $embed) {
//$embed = preg_replace("#height\=\d+#i", "", $embed);
//$embed = preg_replace("#width\=\d+#i", "", $embed);
return $embed;
}
}
?>

View File

@ -115,7 +115,7 @@ function prohibit_mb_email($reg_mb_email)
list($id, $domain) = explode("@", $reg_mb_email);
$email_domains = explode("\n", trim($config['cf_prohibit_email']));
for ($i=0; $i<count($email_domains); $i++) {
if (strtolower($domain) == strtolower($email_domains[$i]))
if (strtolower(settype($domain, "string")) == strtolower(settype($email_domains[$i], "string")))
return "$domain 메일은 사용할 수 없습니다.";
}
return "";