[php5_debug] msglist.php의 기능 버그 및 로직 개선

This commit is contained in:
2018-01-17 16:25:12 +09:00
parent 1b45add2e9
commit c567980221
3 changed files with 34 additions and 5 deletions
+13 -2
View File
@@ -27,12 +27,15 @@ if($con >= 2) { echo "<script>window.top.main.location.replace('main.php');</scr
$msg = str_replace("|", "", $msg);
$msg = trim($msg);
//TODO : 몰라서 임시로 값 세팅해봄. 추후에 용도를 확인하고 수정 필요
$s = 50;
$msg = _String::SubStrForWidth($msg, $s, 198);
$date = date('Y-m-d H:i:s');
// 전체 메세지
if($genlist == 9999 && str_replace(" ", "", $msg) != "") {
echo '<script>console.log('.$me['nation'].')</script>';
if($me['nation'] == 0) {
$nation['name'] = '재야';
$nation['color'] = 'FFFFFF';
@@ -47,6 +50,7 @@ if($genlist == 9999 && str_replace(" ", "", $msg) != "") {
if($me['nation'] == 0) {
$nation['name'] = '재야';
$nation['color'] = 'FFFFFF';
$nation['nation'] = 0;
} else {
$query = "select nation,name,color from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -57,6 +61,13 @@ if($genlist == 9999 && str_replace(" ", "", $msg) != "") {
$query = "select nation,name,color from nation where nation='$genlist'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dest = MYDB_fetch_array($result);
//$dest가 없다는건 수신도 재야.
if(empty($dest)){
$dest['name'] = '재야';
$dest['color'] = 'FFFFFF';
$dest['nation'] = 0;
}
if($nation['nation'] == $dest['nation']) {
PushMsg(2, $nation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:", $nation['color'], $dest['name'], $dest['color'], $msg);
@@ -113,6 +124,6 @@ if($genlist == 9999 && str_replace(" ", "", $msg) != "") {
fclose($fp);
}
//echo "<script>location.replace('msglist.php');</script>";
echo 'msglist.php';//TODO:replace
echo "<script>location.replace('msglist.php');</script>";
//echo 'msglist.php';//TODO:replace
+5 -3
View File
@@ -3184,7 +3184,8 @@ function genList($connect) {
$query = "select no,nation,level,msgindex,userlevel from general where user_id='{$_SESSION['p_id']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$you = array();
$query = "select msg{$me['msgindex']}_who as reply,msg{$me['msgindex']}_type as type from general where user_id='{$_SESSION['p_id']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$reply = MYDB_fetch_array($result);
@@ -3426,8 +3427,9 @@ function MsgFile($skin, $bg, $nation=0, $level=0) {
$msg[$k] = trim($msg[$k]);
}
}
ShowMsg($skin, $bgcolor, $msg[0], $msg[7], $msg[8], $msg[1], $msg[5], $msg[2], $msg[6], $msg[4], $msg[3]);
if(!empty($msg)){
ShowMsg($skin, $bgcolor, $msg[0], $msg[7], $msg[8], $msg[1], $msg[5], $msg[2], $msg[6], $msg[4], $msg[3]);
}
}
}
+16
View File
@@ -236,6 +236,22 @@ class _String {
}
return $string;
}
function Fill($str, $maxsize, $ch) {
$size = strlen($str);
$count = ($maxsize - $size) / 2;
$string = '';
for($i=0; $i < $count; $i++) {
$string = $string.$ch;
}
$string = $string.$str;
for($i=0; $i < $count; $i++) {
$string = $string.$ch;
}
return $string;
}
//우측정렬
public static function Fill2($str, $maxsize, $ch='0') {